简体   繁体   中英

Is it possible to find the jdk vendor for a compiled java file

I have tried to find out the jdk vendor for my class file but haven't been able to.

Can anyone help me in finding out whether Is it possible to find the jdk vendor for a compiled java file. If yes, then how?

See http://en.wikipedia.org/wiki/Java_class_file . There is just no place in the class file header for that information, only for Cafe Babe and the class format version.

There are 10 basic sections to the Java Class File structure:

    Magic Number: 0xCAFEBABE
    Version of Class File Format: the minor and major versions of the class file
    Constant Pool: Pool of constants for the class
    Access Flags: for example whether the class is abstract, static, etc.
    This Class: The name of the current class
    Super Class: The name of the super class
    Interfaces: Any interfaces in the class
    Fields: Any fields in the class
    Methods: Any methods in the class
    Attributes: Any attributes of the class (for example the name of the sourcefile, etc.)

jdk vendor is not mentioned anywhere in java class file structure. You can read Inside the Java Virtual Machine chapter 6 The Java Class File ,I am sure you will not be able to find anything about JDK Vendor.

No it is not possible in reality.

It is theoretically possible for a Java compiler to include a non-standard attribute in the attributes table to hold a compiler vendor name. (The JVM specifically allows non-standard attributes to be used, and requires a JVM to ignore any that it doesn't understand.) However, I know of no compiler that does this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM