[英]How do I make sure that a java program is compatible with Java Enviornment 6?
如何确保我的java程序与Java Enviornment 6兼容?
Run all your tests with the target JVM. 使用目标JVM运行所有测试。
If they pass, your application is by definition compatible with that JVM. 如果它们通过,则根据定义,您的应用程序与该JVM兼容。
You can pass -target 1.6
to the compiler. 您可以将
-target 1.6
传递给编译器。 However, this does NOT guarantee that the bytecode runs with 1.6. 但是,这并不能保证字节码以1.6运行。 It may fail at runtime with Linkage Error when your code uses later API that is not available in 1.6.
当您的代码使用1.6中没有的后续API时,它可能会在运行时因链接错误而失败。
You can use Animal Sniffer to detect you code's compatibility with certain Java version. 您可以使用Animal Sniffer检测代码与某些Java版本的兼容性。
Or just use a 1.6 compiler ... this is probably the best approach. 或者只使用1.6编译器......这可能是最好的方法。 Always use the lowest compiler version you need to be compatible with.
始终使用您需要兼容的最低编译器版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.