什么版本的javac构建了我的jar? [英] What version of javac built my jar?

查看:129
本文介绍了什么版本的javac构建了我的jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何判断使用哪个版本的Java编译器构建jar?我有一个jar文件,它可以在三个JDK中的任何一个中构建。我们需要确切地知道哪一个,所以我们可以证明兼容性。编译器版本是嵌入在类文件或jar中的某个位置吗?

How can I tell what version of the Java compiler was used to build a jar? I have a jar file, and it could have been built in any one of three JDKs. We need to know exactly which one, so we can certify compatibility. Is the compiler version embedded somewhere in the class files or jar?

推荐答案

你无法从JAR文件本身告诉,必然。

You can't tell from the JAR file itself, necessarily.

下载十六进制编辑器并打开JAR中的一个类文件,查看字节偏移4到7.版本信息是内置的。

Download a hex editor and open one of the class files inside the JAR and look at byte offsets 4 through 7. The version information is built in.

http://en.wikipedia.org/wiki/Java_class_file

注意:如下面的评论所述,

Note: As mentioned in the comment below,


那些bytes告诉你该类已被编译为FOR的版本,而不是
编译它的版本。

those bytes tell you what version the class has been compiled FOR, not what version compiled it.

这篇关于什么版本的javac构建了我的jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆