Exception in thread "main" java.lang.NoClassDefFoundError: app
Caused by: java.lang.ClassNotFoundException: app
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: app. Program will exit.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
nik sawtschuk wrote:but how can I make it so I can just type 'java whatever' if i want to run the program (I'll put all my class files in the same folder)
[My Blog]
All roads lead to JavaRanch
MCSA 2003 | Preparing For OCPJP/SCJP6
Disagree. If he is getting that sort of error his PATH is already correct. It is usually a mistake to set a system CLASSPATH at all. If there already is a CLASSPATH set, you only need to add .; or ;. or ;.; to it. If I remember correctly, the JAVAHOME variables should not include the word "bin".Vishal Kashyap wrote: . . .
1] Set CLASSPATH properly in your environment variable, for your class directory.
2] Add <Drive>:\Program Files\Java\Jdk<version>\bin and <Drive>:\Program Files\Java\Jdk<version>\lib in PATH environment variable.
or
3] Set JAVAHOME environment variable for <Drive>:\Program Files\Java\Jdk<version>\bin and <Drive>:\Program Files\Java\Jdk<version>\lib.
. . .
Vishal Kashyap wrote:1] Set CLASSPATH properly in your environment variable, for your class directory.
2] Add <Drive>:\Program Files\Java\Jdk<version>\bin and <Drive>:\Program Files\Java\Jdk<version>\lib in PATH environment variable.
or
3] Set JAVAHOME environment variable for <Drive>:\Program Files\Java\Jdk<version>\bin and <Drive>:\Program Files\Java\Jdk<version>\lib.
MCSA 2003 | Preparing For OCPJP/SCJP6
marc weber wrote:...
java -cp . app
If this works, then that's the problem, and you should consider removing your system CLASSPATH entirely (if you do not need if for some other purpose) or at least adding a dot to the list.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
nik sawtschuk wrote:I never had a SYSTEM CLASSPATH, just a user one.
But I removed that anyways now.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
So did I.marc weber wrote:. . . I said "system" to mean elsewhere in your environment, as opposed to passing an ad hoc classpath with the java command.