Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java not working anymore

915424Feb 5 2012 — edited Feb 5 2012
I have been learning java on my Windows xp system but have found that it has suddnly stopped working.
I am creating source files using notepad and compiling and running from the command line. I can still compile successfully but when I try and run the bytecode I get the following:-

"
C:\JAVA>java HelloUser
Exception in thread "main" java.lang.NoClassDefFoundError: HelloUser
Caused by: java.lang.ClassNotFoundException: HelloUser
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: HelloUser. Program will exit.
"
This for the siimple program

"
public class HelloUser {
public static void main(String[] arguments) {
String username = System.getProperty("user.name");
System.out.println("Hello " + username);


}
}
"


contained in HelloUser.java
which resides in c:\java

This happens for all java programs not just the one listed above.
For this reason I thought the problem must be systematic and after googling found the solution
by common consent was that the classpath variable must be corrected to the correct folder.

My CLASSPATH is currently set to - C:\Program Files\Java\jdk1.6.0_25\bin
but this is where all my java binary files are so there is nothing wrong with classpath.

here is what I get from java version:

C:\JAVA>java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)

C:\JAVA>




How can it be working one day and not the next? Can anyone offer any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2012
Added on Feb 5 2012
2 comments
85 views