Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java command not working

 
Hemang Thanki
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I am using Windows XP SP1.

When I type javac <<File.java>> on commandline, it successfully compile the file.
But when i use java <<File>> on commandline,
"Exception in thread "main" java.lang.NoClassDefFoundError: <<File>>"
though the file consists of main method.

I also set the Path env. variable.

Can anyone suggest me some other approach ?

Regards,
Hemang
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um this really isn't the right place for that question... but you have a problem with the name of the file and the name of the class not being the same (or at least thats my first impression).


-Tad
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to Java in General (beginner).
 
Marco Davids II
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sounds like a like classpath problem.
the classpath variable tells the jvm where to locate java classes
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See How to Set the Classpath in our Java Ranch FAQ for details on setting this system variable. Be sure to add the current working directory to the classpath by prepending the list with ".;".

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic