1. View the meta-inf\manifest in the. jar package. MF
Open the. jar package with compression software such as WinRAR, view the contents of the META-INF\MANIFEST.MF, and the Build-jdk property is the version of the JDK, such as:
build-jdk:1.8.0_91
indicates that its JDK version is 1.8.0_91 .
However, if you do not have this field in a. jar file, you must see it in one of the following ways.
2. View by deserializing the. class file
Unzip the. jar package to get the. class file. Decompile the. class file with the JAVAP from the JDK, using the following command:
Javap-verbose CONFIGURATION.CLASS11
View the resulting information, major the contents of the Version property, as follows
Major version:5211
Indicates that the. class file was compiled by JDK1.8.
-
j2se 6.0 = (0x32 hex)
li>
JDK 1.4 = (0x30 hex)
-
JDK 1.3 = (0x2F hex)
-
jdk 1.2 = (0x2e hex)
-
JDK 1.1 = (0x2D hex)
[note] A. Jar package may have more than one. class file, and the JDK version of each. Class may be different (compiler multiple project settings differ) .
3. How to set up Eclipse export. JDK version of Jar
We can install multiple JDK on the same machine and then choose a different version of the JDK in eclipse to export the. jar package.
Project Right-click->properties-> Java under the JDK Compliance option in compiler, you have use Compliance from execution environment to select the JDK version.
[note] if a. jar is dependent on multiple project, you must select the JDK version of each project consistently.
This article is from the "Green Peak" blog, please make sure to keep this source http://zhuxianzhong.blog.51cto.com/157061/1769340
Determine the JDK version of the. jar package in Java development.