1

I have a jar file located at /home/username/Documents/program.jar and when I open the terminal and type java -jar ~/Documents/program.jar I get the following readout:

Exception in thread "main" java.lang.UnsupportedClassVersionError: amidst/Amidst : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

The command java -version outputs the following:

java version "1.7.0_121"
OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.1)
OpenJDK Client VM (build 24.121-b00, mixed mode, sharing)

What is the problem and how do I fix it?

  • 2
    Most likely you are trying to run a jar that was compiled with a higher JDK version than installed on your current system. Solution is most likely to install the latest java version. For an easy method, check this link: webupd8.org/2012/09/… – E.F. Nijboer Dec 11 '16 at 1:49
  • In terminal, type java -version and include the output in your question. – heynnema Dec 11 '16 at 2:10
  • question has been edited – cheesits456 Dec 11 '16 at 2:22
  • 1
    @E.F.Nijboer make your comment into an answer because it solved my problem – cheesits456 Dec 11 '16 at 2:54
  • Happy I could help you out ChristianF97. – E.F. Nijboer Dec 13 '16 at 17:59
3

The java -version command confirms that you're running an older version of openjdk (and you may have mixed in a little Oracle Java 7... choose one, not both). Here's the current version information for openjdk...

openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.10.2-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

Start Software Updater from the Unity dashboard and update your software.


If you'd rather use Oracle Java, another way to update your java version (specifically if you're using a release less than 16.04) is to use the ppa from the webupd8 team using the following steps:

1) Open terminal (ctrl+alt+t)

2) Enter the following commands:

$ sudo add-apt-repository ppa:webupd8team/java -y
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer -y
$ sudo apt-get install oracle-java8-set-default

3) Enjoy java 8 :)

Side note - Last package (oracle-java8-set-default) may not be necessary to install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.