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?