Determine the JDK version of the. jar package in Java development.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.