Results 1 to 11 of 11
  1. #1
    dridriun is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Virtual machine launcher : A Java Exception has occured

    Hi,

    I developped a Java application and it works fine on my computer, but when i tried it on another computers, I have the following errors :

    A window named Java Virtual Machine Launcher appears and it says "A Java Exception has occured".
    My application don't even launch.

    Here is the error lines, but I don't know what to do :

    C:\Users\Administrateur_local\serveurtimet>java -jar ServeurTimeT.jar
    Exception in thread "main" java.lang.UnsupportedClassVersionError: TimeTracking/
    ServeurTimeT : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknow n 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.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 sun.launcher.LauncherHelper.checkAndLoadMain(Unkno wn Source)

    Java is up to date.

    Please I need help.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Virtual machine launcher : A Java Exception has occured

    "Java is up to date" - well one version of Java installed is up to date then, but the version of Java being used to run the application is too old. That's what the "java.lang.UnsupportedClassVersionError" thing means. You can google that and confirm it.

    Try executing

    java -version

    and see what you get.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    dridriun is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: Virtual machine launcher : A Java Exception has occured

    I tried it and java is 1.8.0_05 on my computer but 1.7.0.55 on the other computer...
    The problem is that the computer on 1.7 says the computer has the most recent version of Java...

    Both OS are windows 7.

    I don't understand

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Virtual machine launcher : A Java Exception has occured

    The most recent version of Java 7, yes. But you compiled your application for Java 8, a completely different release of Java.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    dridriun is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: Virtual machine launcher : A Java Exception has occured

    I compiled with the default compiler on netbeans. And why does it worked on my computer ?
    I changed the Source/Binary format to JDK 7 and it works.

    Thanks a lot

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Virtual machine launcher : A Java Exception has occured

    Because you have Java 8?

    I'm starting to feel like captain obvious here.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    6

    Default Re: Virtual machine launcher : A Java Exception has occured

    You can quickly get relevant information by doing an simple Internet search using the search term "UnsupportedClassVersionError." Here's a page that I found that will answer most/all of your questions: How to resolve java.lang.UnsupportedClassVersionError with example

    Quote Originally Posted by dridriun View Post
    I tried it and java is 1.8.0_05 on my computer but 1.7.0.55 on the other computer...
    The problem is that the computer on 1.7 says the computer has the most recent version of Java...
    At the moment both Java 7 (1.7) and Java 8 (1.8) have not reached their end of public updates. ("Public update" means updates - bug fixes - to the versions are made available to the public without charge. When a version has reached its end of public update, further updates can only be obtained through paid support.) In your case, the other computer has the latest update for Java 7, which is Java 7 update 55, hence "the most recent version" (of Java 7.)

    Quote Originally Posted by dridriun View Post
    I compiled with the default compiler on netbeans. And why does it worked on my computer ?
    I changed the Source/Binary format to JDK 7 and it works.
    Quoting from the article I referenced above,
    "When JVM tries to load a class and found that class file version is not supported it throws UnSupportedClassVersionError and it generally occurs if a higher JDK version is used to compile the source file and a lower JDK version is used to run the program."

    Also,
    "But its [sic] important to note is that vice-versa is not true "you can compile your program in J2SE 1.4 and run on J2SE 1.5 and you will not get any UnSupportedClassVersionError"."

    In your case a class file compiled using JDK 8, without explicitly changing the binary format to a lower version, will run with Java 8 but not with Java 7. A class file compiled using JDK 8, with the binary format changed to Java 7, will run with both Java 7 and 8.

  8. #8
    dridriun is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: Virtual machine launcher : A Java Exception has occured

    Yes I understand, that is logical.
    I just understood right now that Java 8 isn't public yet.
    I don't have it on the other computer because I haven't IDE for Java installed.

    Thank you for your answers.

  9. #9
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Posts
    447
    Rep Power
    6

    Default Re: Virtual machine launcher : A Java Exception has occured

    Quote Originally Posted by dridriun View Post
    I just understood right now that Java 8 isn't public yet.
    So you didn't understand it.

    A product can have multiple releases. Just look at Windows. There is WIndows XP, Windows Vista, Windows 7, Windows 8, Windows 8.1, ....
    Each version gets updates. So you can check your Windows 7 to see if there are any updates. And it will tell you: There are no updates available.
    But that does not mean that your WIndows 7 is the latest major release. And that does not mean that Windows 8 is "not public" or anything like that.

    It simply means that you have a different major version!

    So an Application that only runs on Windows 8 will not run on Windows 7, Vista or XP.

    And it is exactly the same with Java. If you compile something that requires Java 8, then you simply need to have Java 8 on your system. And if the system only has Java 7, then you could simply go and install Java 8, too.

    Konrad

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Virtual machine launcher : A Java Exception has occured

    Pretty sure that if in the original questions "Java" was replaced with "Adobe Flash", all of a sudden things would have been crystal clear even though it is exactly the same situation.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    dridriun is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: Virtual machine launcher : A Java Exception has occured

    You are right ! Now I know how Java works after 2 years of programming haha

Similar Threads

  1. Java Web Start using u45 virtual machine
    By dalcorta in forum Java Applets
    Replies: 0
    Last Post: 12-13-2013, 10:30 PM
  2. Java Virtual Machine Launcher problem
    By lamiajoyee in forum New To Java
    Replies: 13
    Last Post: 01-15-2012, 03:35 AM
  3. Could not create Java Virtual Machine
    By cr6 in forum New To Java
    Replies: 0
    Last Post: 02-16-2011, 11:40 PM
  4. Virtual machine of java.
    By Albert in forum Advanced Java
    Replies: 1
    Last Post: 07-05-2007, 09:48 PM
  5. C# Java Virtual Machine 1.0.1
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-25-2007, 08:47 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
  •