Saturday, May 22, 2010

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 "Limits.java" 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%26gt;" 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.

What is wrong with my program?
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


SET CLASSPATH =%CLASSPATH%;.


provided that your class files are in the current directory.





:-)


No comments:

Post a Comment