Skip to main content

CMD problems running in VISTA

3 replies [Last post]
liverpool
Offline
Joined: 2008-09-21
Points: 0

I have the directory: C:\Java\jre1.6.0_07 where my 'bin' folder is

I've set the environment variables (PATH Statement) to the above ie: C:\Java\jre1.6.0_07

This is what happens when I try and run the HelloWorld application from the CMD window:

C:\Users\SOLARIS>java HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

C:\Users\SOLARIS>java HelloWorld.java
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/java
Caused by: java.lang.ClassNotFoundException: HelloWorld.java
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

The application works fine in Eclipse but I just cannot get it to run in CMD.

Any Ideas Anyone?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
trembovetski
Offline
Joined: 2003-12-31
Points: 0

what is your CLASSPATH?

liverpool
Offline
Joined: 2008-09-21
Points: 0

C:\Java\jre1.6.0_07

trembovetski
Offline
Joined: 2003-12-31
Points: 0

Either unset it:
[code]
set CLASSPATH=
[/code]
or add current directory:
[code]
set CLASSPATH=.;%CLASSPATH%
[/code]

Dmitri