• Post Reply Bookmark Topic Watch Topic
  • New Topic

path  RSS feed

 
Hans DeRoock
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running on a PC w/Windows XP prof. I tried and ran the beginners program HelloWorldApp. I got the "Exception in the thread 'main' Java.lang.NoclassDeffound error". I updated my autoexec.bat file and I had to "clobber" the system with a "set CLASSPATH" before it ran. I also ran succesfully a few other programs I wrote from the HFJ book. But now it gives me the same error as above. And what ever I do it gives me the same error. Even with the programs that run succesful before. I need Help! Any suggestion other than suicide?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To help diagnose the probolem, type the following command at the command-prompt:

What is the output? Did you set this CLASSPATH variable yourself or do you have other programs installed that use it? If you set it yourself, then you should remove it completely. At this point in learning Java, the CLASSPATH variable is unnecessary and causes much confusion. If other programs use it as well, then you need to make sure the CLASSPATH includes . (dot), which stands for the current directory. Make sure that you separate this from the previous path in the CLASSPATH variable with a ; (semi-colon). If you aren't sure how to remove the CLASSPATH variable or how to change it, please post the output of the above command first and we will help you from there.

Layne
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you compile and run these files, are you first changing the directory to where these files are? In the Windows Command Prompt, the command to change directory is cd, so -- for example -- if your files are under c:\myJava\tests, you would type...

cd c:\myJava\tests

If this doesn't solve the problem, then please post exactly what you have in your PATH variable. (At the HelloWorld stage, you should not need a CLASSPATH set at all.)
 
Hans DeRoock
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did an echo and the reply is:
Program Files\Java\jre1.5.0_05\lib\ext\QTJava.zip. In the this directory I also see a jre1.5.0_06. Could this be a problem?
I write and compile my prgrams from the C:\java> directory. The ".java" and the ".class" files are located in this directory. It run at first but will not run anymore and I don't run any other programs. javascript: x()
banghead
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you mean that this is the value of the CLASSPATH variable and that you left off the "C:\" in the front. If this is the case, then you need to modify the CLASSPATH variable and add ".;" at the beginning. This will ensure that java and javac can find classes in the current directory.

Layne
 
Hans DeRoock
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes! I inserted the dot and semicolon and now it works.
Thx for your help!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!