是否可以找到已编译的java文件的jdk供应商

时间:2012-06-27 13:15:16

标签: class java compiled

我试图找出我的类文件的jdk供应商,但却无法找到。

任何人都可以帮我找出是否有可能为编译的java文件找到jdk供应商。如果是,那怎么办?

3 个答案:

答案 0 :(得分:5)

http://en.wikipedia.org/wiki/Java_class_file。类信息的类文件头中没有位置,仅适用于Cafe Babe和类格式版本。

答案 1 :(得分:2)

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供应商的任何信息。

答案 2 :(得分:0)

不,实际上不可能。

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

相关问题