如何运行.jar 1.7程序与旧版本的java 1.6? [英] how to run a .jar 1.7 program with an older version java 1.6?

查看:146
本文介绍了如何运行.jar 1.7程序与旧版本的java 1.6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个code.jar在1.7版本的java中运行得很好,但是当使用另一台带有1.6版本的linux的电脑时,它给我一个错误,我该如何在1.6版本中运行?

解决方案

使用 javac 时,可以使用crosscomp-optionsrel =nofollow>交叉编译选项



如果只有 -target 选项在大多数其他回复中被推荐,1.7 SDK将发出警告关于 -bootclasspath 。该选项需要目标JRE版本的 rt.jar (注意 JDK)。它允许编译器检查引用核心Java SE的代码的类,方法和属性实际存在于 rt.jar 中。这对确保兼容性非常重要。


I have a code.jar running well in 1.7 version java, but when using another computer with linux with version 1.6 it is giving me an error, how can I run it in 1.6 version?

解决方案

Use the cross-compilation options when invoking javac.

If only the -target option is specified as recommended in most other replies, the 1.7 SDK will issue a warning about -bootclasspath. That option requires an rt.jar of the target JRE version (note not JDK). It allows the compiler to check that the classes, methods and attributes of the code that reference core Java SE are actually present in the rt.jar. This is very important to ensure compatibility.

这篇关于如何运行.jar 1.7程序与旧版本的java 1.6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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