• Post Reply Bookmark Topic Watch Topic
  • New Topic

J2sdk1.4.1_02 installation  RSS feed

 
Angela D'souza
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I installed j2sdk1.4.1_02. I just add some environment varible in System varibles:
JAVA_HOME :c:/jdk1.4(my working directory name is jdk1.4 instead j2sdk1.4.1_02).
Path = %JAVA_HOME%\bin
I tried to run simple HelloWorld program from command prompt using
c:/jdk1.4/bin> java c:/HelloWorld
It's not working. It's gives following error:
Exception in thread "main" java.lang.NoClassDefFoundError: c:/HelloWorld
Do you know why?
Thanks,
Angela
 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your CLASSPATH point to the directory where the HelloWorld.class file is?
 
Angela D'souza
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marilyn de Queiroz:
Does your CLASSPATH point to the directory where the HelloWorld.class file is?

No, How can I add? Also, I may have different directories for so many other class files. Do I need to add all those directories?
Angela
 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just add an environment variable in System variables:
CLASSPATH c:\<the path to your *.class file>

c:\>java HelloWorld

If you want to have your class files in various subdirectories on your harddrive, you will have to

add all the subdirectories to your system variable (not recommended)

or

set the classpath in each DOS window

SET CLASSPATH=(your new classpath)

(which you could do in a batch file if you prefer)

or run using the -classpath option each time:

c:\>java -classpath <path to your file> HelloWorld
[ January 02, 2004: Message edited by: Marilyn de Queiroz ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!