Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2004

Tip: Looking for answers? Try searching our database.

(newbe) NoClassDefFoundError complaints

Thread view: 
Martin - 12 Apr 2004 14:46 GMT
Hello,

I just installed javaSDK 1.5.0 beta on WinXP.
And I set the Path right.

So now I'm able to invoke javac from any place.

Nu I wrote this simple hello-world prog (test.java). I compiled it with
javac. So far so good. A test.class is created.

Now when I want to execute this helloworld app, I type
java test.class

But it won't execute. A complaint arises:
"Exception in thread "main" java.lang.NoClassDefFoundError: test/class"

Can someone help me out with this one??
thanks a lot

martin
Mark Hansen - 12 Apr 2004 15:23 GMT
> Hello,
>
[quoted text clipped - 13 lines]
>
> Can someone help me out with this one??

When running java, you don't give the .class extension. The interpreter
just needs to be able to find the .class files on the class path. For
example:

  java -classpath . test

(assuming test.class is located in the current directory).

Side note: By convention, most classes are named with an initial capital,
such as Test.java, rather than test.java. Also, remember that the class
name must match the file name. So the "Test" class must be in a file
named "Test.java" (or, in your case, the "test" class must be in a file
named "test.java") - they just need to match.

> thanks a lot
>
> martin
Martin - 12 Apr 2004 15:56 GMT
IT WORKS!
of course ;-))

thnx

martin

> > Hello,
> >
[quoted text clipped - 31 lines]
> >
> > martin
Mark Hansen - 12 Apr 2004 16:12 GMT
> IT WORKS!
> of course ;-))
>
> thnx
>
> martin

If you want to learn Java, you should really pick up the book
Core Java 2, Volume I (Second Edition). This goes very well
through all the 'basics' needed to get off the ground.

<http://www.amazon.com/exec/obidos/ASIN/0130471771/qid=1081782637/sr=2-1/ref=sr_2
_1/104-6973209-1900719
>

Good luck.
Mark Hansen - 12 Apr 2004 16:14 GMT
>> IT WORKS!
>> of course ;-))
[quoted text clipped - 6 lines]
> Core Java 2, Volume I (Second Edition). This goes very well
> through all the 'basics' needed to get off the ground.

Oops, that should have read "Sixth Edition", not "Second Edition", sorry.
The link went to the correct book though...

> <http://www.amazon.com/exec/obidos/ASIN/0130471771/qid=1081782637/sr=2-1/ref=sr_2
_1/104-6973209-1900719
>
>
> Good luck.
Martin - 12 Apr 2004 17:37 GMT
I have "Technical Java"

It begins very readable, but soon it gets too technical (too abstract)...
regards
martin

> > IT WORKS!
> > of course ;-))
[quoted text clipped - 6 lines]
> Core Java 2, Volume I (Second Edition). This goes very well
> through all the 'basics' needed to get off the ground.

<http://www.amazon.com/exec/obidos/ASIN/0130471771/qid=1081782637/sr=2-1/ref
=sr_2_1/104-6973209-1900719>

> Good luck.
Roedy Green - 12 Apr 2004 23:19 GMT
>If you want to learn Java, you should really pick up the book
>Core Java 2, Volume I (Second Edition). This goes very well
>through all the 'basics' needed to get off the ground

for other resources see http://mindprod.com/jgloss/gettingstarted.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Roedy Green - 12 Apr 2004 23:19 GMT
>   java -classpath . test

and test should be Test. the source should live in Test.java creating
Test.class.

see http://mindprod.com/jgloss/codingconventions.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Roedy Green - 12 Apr 2004 23:15 GMT
>java.lang.NoClassDefFoundError: test/class"

See http://mindprod.com/jgloss/errormessages.html#NOCLASSDEFFOUND

and also
http://mindprod.com/jgloss/javaexe.html

You don't append .class on the command line.
Java is very picky about that.
Just to keep you on your toes, you MUST append the extension *.java on
the command line for Javac.  It is trivia to harass the plebes.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.