Incorrect bytecode version stamp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Incorrect bytecode version stamp

Jan Tosovsky
Dear All,

when building Apache Batik tools using Oracle JDK 7u80 (most recent free) to
ensure they will work on JDK 7, I am getting weird result (Win 10).

While in MANIFEST can be found 'created by' JDK 7, when that main class is
executed in JDK 7, executing of the main class fails because of unsupported
version (major.minor 52.0).

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.7
Created-By: 1.7.0_80-b15 (Oracle Corporation)
Implementation-Title: Batik SVG rasterizer
Implementation-Version: svn-trunk
Implementation-Vendor: The Apache Software Foundation (http://xmlgraph
 ics.apache.org/batik/)
Main-Class: org.apache.batik.apps.rasterizer.Main
Build-Id: 20161220-223305-CET (Honza [Windows 8.1 6.3 amd64, Java 1.7.
 0_80-b15])

I suspect this is Ant/compiler issue of incorrectly written version stamp
into class files. Or is there other explanation how JDK 7 can produce JDK 8
bytecode?

There is JDK8 installed on my PC as well, but both JAVA_HOME and PATH
variables point to the JDK7. Is it possible Ant could bypass this settings
internally? Is that MANIFEST 'created by' value reliable?

Thanks,

Jan




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incorrect bytecode version stamp

Stefan Bodewig
On 2016-12-20, Jan Tosovsky wrote:

> While in MANIFEST can be found 'created by' JDK 7, when that main class is
> executed in JDK 7, executing of the main class fails because of unsupported
> version (major.minor 52.0).

The "Created-by" reflects the JVM that is executing Ant. The class
version is determined by the javac that has been used which can be
different from the one of the JVM running Ant depending on your <javac>
task. For example if you use a forking javac it might be the first
javac.exe that's on the PATH.

Can you show us the <javac> task that is compiling the classes?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Incorrect bytecode version stamp

Jan Tosovsky
On 2016-12-21 Stefan Bodewig wrote:

> On 2016-12-20, Jan Tosovsky wrote:
>
> > While in MANIFEST can be found 'created by' JDK 7, when that
> > main class is executed in JDK 7, executing of the main class
> > fails because of unsupported version (major.minor 52.0).
>
> The "Created-by" reflects the JVM that is executing Ant. The class
> version is determined by the javac that has been used which can be
> different from the one of the JVM running Ant depending on your <javac>
> task. For example if you use a forking javac it might be the first
> javac.exe that's on the PATH.
>
> Can you show us the <javac> task that is compiling the classes?

Silly me, I haven't executed 'clean' goal between my attempts so those
originally built classes (in JDK8) were never overwritten when later
creating jars in JDK7.

Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...