3

First of all, allow me a little disclaimer: I know about this error, that occurs when I try to execute in a 1.7 or lower JVM a class that has been compiled with Java 1.8. However, in my case, something strange is happening. Of course, I am having the following error when executing a class with Java 1.7:

java.lang.UnsupportedClassVersionError: registrazioneutenti/RegistrazioneUtente : Unsupported major.minor version 52.0

while I have no problems running Java 1.8.

The strange thing is that this class IS indeed compiled with Java 1.7, as the Manifest says:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.1
Created-By: 1.7.0_79-b15 (Oracle Corporation)

moreover, issuing a file command on RegistrazioneUtente.class outputs:

RegistrazioneUtente.class: compiled Java class data, version 51.0

So I'm really puzzled: why I'm getting the exception complaining about version 52.0?

There's only one thing I can think about: since this is a JAX-WS compiled class, coming from a SOAP WebService, NetBeans took care of the compilation. Since I couldn't control the Java compiler for such a compiled class, I had to start NetBeans with a 1.7 JDK and even modifying my PATH environment variable in order to get the 1.7 javac. I am wondering: wasn't this enough? How am I supposed to create a SOAP WebService class in NetBeans to target Java 1.7 correctly?

Claudio Mezzasalma
  • 646
  • 1
  • 5
  • 23
  • Does this help: http://stackoverflow.com/questions/22489398/unsupported-major-minor-version-52-0 ? – Rahul Tripathi Nov 20 '15 at 08:13
  • Honestly, not much. As I said, the class *is* already compiled with Java 1.7; moreover, I wouldn't know how to use such an option while generating the class from within NetBeans, since it is an automated process managed by the IDE itself. Even modifying the JDK on which NetBeans runs on, and modifying my PATH environment variable, looks like an hack in my eyes... – Claudio Mezzasalma Nov 20 '15 at 08:16

0 Answers0