繁体   English   中英

是否可以找到已编译的Java文件的JDK供应商

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

我试图找出我的类文件的jdk供应商,但未能做到。

谁能帮助我找出是否有可能为已编译的Java文件找到jdk供应商。 如果是,那怎么样?

请参阅http://en.wikipedia.org/wiki/Java_class_file 在类文件头中没有该信息的位置,仅在Cafe Babe和类格式版本中。

Java类文件结构有10个基本部分:

    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.)

Java类文件结构中的任何地方都没有提到JDK供应商。 您可以阅读Inside the Java Virtual Machine第6章The Java Class File ,我确定您将找不到有关JDK Vendor的任何信息。

不,在现实中不可能。

从理论上讲,Java编译器可能会在attributes表中包含非标准属性来保存编译器供应商名称。 (JVM专门允许使用非标准属性,并且要求JVM忽略它不了解的任何属性。)但是,我知道没有编译器可以执行此操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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