Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 5 votes, 4.60 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-25-2008, 02:35 PM   PM User | #1
littlemiss
New Coder

 
Join Date: Aug 2007
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
littlemiss is an unknown quantity at this point
java.lang.UnsupportedClassVersionError: Bad version number in .class file

Hey,

Its a strange one, I have not edited Eclipse in anyway, but every time i try to compile my program i get the following error:

java.lang.NoClassDefFoundError: Draw
Exception in thread "main"

The program was working a week ago, I have no edited it at all i tried to run it the next day and this error came up.

I am now having to code in notepad and compile using the cmd, its really causing problems, does anybody have any idea what this error is and how to fix it?


oh it seems to not just be eclipse anymore, the cmd gave out the following stuff when i tried to run


C:\Documents and Settings\workspace\ProjectMobile>java GUI.java
Exception in thread "main" java.lang.NoClassDefFoundError: GUI/java
Caused by: java.lang.ClassNotFoundException: GUI.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)

Last edited by littlemiss; 02-25-2008 at 03:25 PM..
littlemiss is offline   Reply With Quote
Old 02-25-2008, 02:37 PM   PM User | #2
Rappa
Regular Coder

 
Rappa's Avatar
 
Join Date: Nov 2005
Location: LI
Posts: 356
Thanks: 21
Thanked 9 Times in 9 Posts
Rappa is an unknown quantity at this point
I suppose it would help if you posted your code.
Rappa is offline   Reply With Quote
Old 02-25-2008, 02:39 PM   PM User | #3
littlemiss
New Coder

 
Join Date: Aug 2007
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
littlemiss is an unknown quantity at this point
Its not the code. I created a simple hello world program in a new project and it had the same error.
littlemiss is offline   Reply With Quote
Old 02-25-2008, 02:55 PM   PM User | #4
sobrien79
Regular Coder

 
Join Date: Jan 2008
Location: Willow Grove, PA
Posts: 169
Thanks: 1
Thanked 27 Times in 27 Posts
sobrien79 is an unknown quantity at this point
Have you tried reinstalled eclipse?
sobrien79 is offline   Reply With Quote
Old 02-25-2008, 03:03 PM   PM User | #5
littlemiss
New Coder

 
Join Date: Aug 2007
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
littlemiss is an unknown quantity at this point
Yeah i tried installing some plug ins, then i tried re installing, then i tried installing easyeclipse and its all the same error, its really weird, i have no clue whats going on!
littlemiss is offline   Reply With Quote
Old 02-25-2008, 03:16 PM   PM User | #6
littlemiss
New Coder

 
Join Date: Aug 2007
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
littlemiss is an unknown quantity at this point
I tried to run my program using the cmd, and now that doesnt work! Here is the info it gave out



C:\Documents and Settings\workspace\ProjectMobile>java GUI.java
Exception in thread "main" java.lang.NoClassDefFoundError: GUI/java
Caused by: java.lang.ClassNotFoundException: GUI.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)

Anybody know what this means?
littlemiss is offline   Reply With Quote
Old 02-25-2008, 04:05 PM   PM User | #7
littlemiss
New Coder

 
Join Date: Aug 2007
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
littlemiss is an unknown quantity at this point
It seems eclipse has made a java app called draw some where, i dont know where, but i tried running things and this new error came up:

java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)

Its similar to the cmd error, but i dont understand what it means
littlemiss is offline   Reply With Quote
Old 02-25-2008, 06:23 PM   PM User | #8
Aradon
Moderator-san


 
Aradon's Avatar
 
Join Date: Jun 2005
Location: USA
Posts: 734
Thanks: 0
Thanked 20 Times in 19 Posts
Aradon is on a distinguished road
In order to compile a java program inside of the command line (cmd) then you have to use javac, NOT java.

So you would do:

Code:
javac GUI.java
java GUI
Notice that on java GUI, the .class or .java is not present! Also we will need to see your draw.java code if we are to figure out what is going on with eclipse.
__________________
"To iterate is human, to recurse divine." -L. Peter Deutsch
Aradon is offline   Reply With Quote
Old 05-15-2009, 11:54 AM   PM User | #9
mehagrover
New to the CF scene

 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
mehagrover is an unknown quantity at this point
" Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file"
this is because the code was compiled on a new version of java and u r trying to run it onthe older version of java. Please make sure that both the versoins are same.
mehagrover is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:03 AM.


Advertisement
Log in to turn off these ads.