JRE trouble

ichwar

Community Advocate
Community Support
Messages
1,454
Reaction score
7
Points
0
So for some reason, my java runtime environment isn't working. For reference, I'm using ubuntu 9.04 64-bit. For a while it was working just fine, and then all of a sudden a couple of days ago, I tried to run a .class I had just compiled and I got this error:
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: EmployeeTest/java
Caused by: java.lang.ClassNotFoundException: EmployeeTest.java
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: EmployeeTest.java.  Program will exit.

I tried removing jre, then reinstalling it, but still the problem persists. Has anyone had this problem? Does anyone know how to fix this?
Thanks.
 

adam.k

New Member
Messages
41
Reaction score
1
Points
0
It looks like it can't find a class or something within the class file. Of course I could be totally wrong, have you recently updated your JRE?
 
Last edited:

ichwar

Community Advocate
Community Support
Messages
1,454
Reaction score
7
Points
0
You're very close. I actually just got this problem resolved on another forum. Thanks for the help though.

My problem was that I was the .class extension on the end of the filename. eg. I was typing
java EmployeeTest.class
when the correct syntax is
java EmployeeTest
and java will automatically sort out the .class files itself.

Well, I guess a mod can lock or remove this thread now. :)
 

nirajkum

New Member
Messages
159
Reaction score
0
Points
0
Set the class path to EmployeeTest.class file its the classpath problem ...
 
Top