Ok so I just finished an assignment for university and wanted to test my solution on their server and got this exception:
[java] Exception in thread "main" java.lang.UnsupportedClassVersionError: controller/CloudController : Unsupported major.minor version 52.0
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
[java] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[java] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[java] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
[java] Java Result: 1
I checked the server and found out they are using Java 7 while I used Java 8 already.
What I then tried was this:
I changed the Project language level to 7, but still this hasn`t solved the problem.
So here is my question, do I really have to download the 1.7 jdk to make this work, because I want to avoid this. The program has to run on the server though, since it is used for the grading and I obviously can`t update the Java version on an university server.
Thanks for any answers in advance.
No, you shouldn't need to download JDK 7. This is a project level setting. Here is how I do it on IntelliJ IDEA 14, but I suspect it is the same if you are on 13 or 12.
Go to Settings->Build,Execution,Deployment->Compiler->Java Compiler. Under that tab you should see a Project-wide setting for Project Bytecode Version. Set that to 1.7 and you should be set.
You can also set the per-module settings here if for some reason you have some modules on one version and other modules on another version (but it doesn't sound like you do in this case).