Question by Michael M: What is wrong with my program?
I have this program I was given to work on in my class. I have no idea what any of it means, because they just wanted me to get used to the javac and java comands. I have saved my program “” and compiled it so that I have “Limits.class”. They are both in the path “C:\Documents and Settings\owner\.jedit\”. When I try to do the java comand in my prompt, I get an error “Exception in thread “main” java.lang.NoClassDefFoundError: Limits/java” in my command prompt. I am in “C:\Documents and Settings\owner\.jedit>” on my command prompt. Do I have to set the class path, because I think I changed it in environmental variables when I was trying to get the path set for javac by accedent. If that has nothing to do with my problim just ignore it. Always beter to have too much information than not enough.

Best answer:

Answer by the_adrastos
This might help.

1. Add the path of the java executable to environment variable PATH. How you do that is by adding a semicolon to the already set paths there, then append it with the java executables path. for eg.. if you have installed java in c:\jdk\bin then simply append this to the PATH variable after a semicolon.

2. Before you run a program set the classpath to the current directory. The command at the command prompt can be
provided that your class files are in the current directory.


Know better? Leave your own answer in the comments!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.