0

After the most recent automatic software update, java 7 on 14.04 no longer works. The initial problem is the same as that described at "How to upgrade Java compiler".

Here's the message we got:

warning: Blabla.class: major version 52 is newer than 51, the highest major version supported by this compiler.

it is recommended that the compiler be upgraded.

The solution given there was suggested after the questioner gave the outputs of "javac -version" and "java -version" - these two were not the same.

In my case, the output of these queries appears to be the same. Here they are, in case I'm missing something:

javac -version

javac 1.7.0_95

java -version

java version "1.7.0_95"

OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.2) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

executing

"sudo update-alternatives --config javac"

showed three alternatives. I tried all three, and none worked. I then completely removed all java from the system (following the instructions at "How to completely uninstall java".) I then installed java 7 from the Oracle site. While the original error message still occurs and I can't run a compiled program, there is now only one alternative after

"sudo update-alternatives --config javac"

it says: There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-7-openjdk-amd64/bin/javac Nothing to configure.

For completeness, here is what happens when I try to compile/run a program that was working just before the automatic update:

lanzcc@ubuntu910:~/recruit$ javac ReadProgram.java

warning: ./Program.class: major version 52 is newer than 51, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. 1 warning

lanzcc@ubuntu910:~/recruit$ java ReadProgram

Exception in thread "main" java.lang.UnsupportedClassVersionError: Program : 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:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 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 java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2625) at java.lang.Class.getMethod0(Class.java:2866) at java.lang.Class.getMethod(Class.java:1676) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) lanzcc@ubuntu910:~/recruit$

Any ideas?

THANKS!

1 Answer 1

0

RESOLVED

There was, among the various class files, one that had not been compiled since the software upgrade. I knew all the others were being recompiled, but I just didn't notice this one. Thus it had a non-matching compiler tag.

Sorry.

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.