Results 1 to 9 of 9
  1. #1
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Unsupported class version.

    I am using netbeans ide on mac, i do work on netbeans on a windows machine whilst doing lab work. I created some small programs and copied the project so i could take it home and work on it here. When i try to run the program i get this error message.

    Java Code:
    Exception in thread "main" java.lang.UnsupportedClassVersionError: EmptyFrameView : Unsupported major.minor version 51.0
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Java Result: 1
    Now i have searched and found that it could be from using two different versions of jdk? I have updated to the latest version on my mac and netbeans is fully up to date as far as i can see. I have managed to run programs which i have created on this machine, but it wont run programs i created using the windows machine. I need to be able to be able to run the same programs on both, any ideas?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,874
    Rep Power
    8

    Default Re: Unsupported class version.

    What version of the JDK are you using to compile the code? What version of the JRE are you using to run it?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: Unsupported class version.

    Quote Originally Posted by KevinWorkman View Post
    What version of the JDK are you using to compile the code? What version of the JRE are you using to run it?
    I have downloaded the jdk from here Oracle Java Development Kit 7u7 Downloads
    I believe that is the latest version?
    The jre is 1.7.0_07

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,874
    Rep Power
    8

    Default Re: Unsupported class version.

    How are you compiling this? How are you running it? Try compiling and running via the command prompt to eliminate any IDE issues. What happens on each machine when you type "java -version" into the command prompt? What about "javac -version"?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: Unsupported class version.

    I only have access to my machine at the moment "javac -version" returns "javac 1.6.0_35"
    The program runs when using the terminal, as does the same code when copied into a new project which has been created on this computer.

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,874
    Rep Power
    8

    Default Re: Unsupported class version.

    And what about "java -version" on that machine? My guess is that the compiler on the other machine is 1.7, whereas the JRE on this machine is 1.6 (the compiler can be different from the JRE, which is why I suggest testing both java and javac's versions). Try upgrading your JRE to 1.7 on this machine- that might include updating your path.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: Unsupported class version.

    Quote Originally Posted by KevinWorkman View Post
    And what about "java -version" on that machine? My guess is that the compiler on the other machine is 1.7, whereas the JRE on this machine is 1.6 (the compiler can be different from the JRE, which is why I suggest testing both java and javac's versions). Try upgrading your JRE to 1.7 on this machine- that might include updating your path.
    I think that might be the problem, i have downloaded the latest JRE now as well. Under sources for the project properties it says illegal source level JDK7 so i will have to see how i can get netbeans to point to the right files now.

  8. #8
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: Unsupported class version.

    Quote Originally Posted by wdh321 View Post
    Exception in thread "main" java.lang.UnsupportedClassVersionError: EmptyFrameView : Unsupported major.minor version 51.0
    You may think you are running this against 1.7, but the above says "no".
    "51.0" is the version compiled against, which represents 1.7 ("50" would be 1.6, etc etc), which it says is unsupported, which means you are trying to run aganst an earlier version.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: Unsupported class version.

    So basically the computer i originally used was using 1.7 but the one i am on now is running an earlier version. I have managed to navigate into the java preferences and moved 1.7 to the top so when i run "javac -version" i now get "1.7.0_07".
    EDIT: All now working properly, thanks guys.
    Last edited by wdh321; 10-02-2012 at 05:13 PM.

Similar Threads

  1. Replies: 2
    Last Post: 06-25-2012, 08:01 PM
  2. Unsupported major.minor version 51.0
    By j2me64 in forum Java Applets
    Replies: 15
    Last Post: 04-15-2012, 10:35 AM
  3. Shall we skip Unsupported class version error?
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 04-21-2011, 01:11 PM
  4. Replies: 5
    Last Post: 03-31-2011, 12:17 PM
  5. Class Version in Serialization
    By Gunas in forum New To Java
    Replies: 5
    Last Post: 02-04-2010, 04:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •