Forums Register Login

J2sdk1.4.1_02 installation

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Does your CLASSPATH point to the directory where the HelloWorld.class file is?
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
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 ]
I knew that guy would be trouble! Thanks tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1429 times.
Similar Threads
Java version
J2EE 1.3.1 RI Server set up problem
can't start j2ee server - What to do?
doubt in setting class path
How To Run build.xml?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 01:58:44.