Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Erica Matthews   on Apr 26 In Java Category.

  
Question Answered By: Garai Chalthoum    on Apr 26

If your javac  command (the line that read "javac hello.java") compiled  the
source code with no errors, then
a file named hello.class was created in the directory you ran it from.

If the java  command (the line that read "java hello") gives the error you
mention, it means that the java executable can not find the file hello.class.

Running the command "set" will reveal if you have a CLASSPATH environment
variable set and what it is set to.

You can also specify a classpath when you run the java executable with a
classpath switch in several ways:

java -classpath "C:\" hello

or

java -classpath %CLASSPATH%;"." hello

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Exception in thread "main" java.lang.NoClassDefFoundError Or get search suggestion and latest updates.


Tagged: