[英]Using a JAR package that uses a different Java version in eclipse
I have Java 8 and I've been trying to use a JAR package that uses JRE 6. In 'Create a Java Project' I used the 'Use a project specific JRE' and also created a run configuration but when I try to set the alternate JRE to 6, the 'run' button gets blocked out. 我有Java 8,并且一直在尝试使用使用JRE 6的JAR包。在“创建Java项目”中,我使用了“使用项目特定的JRE”,还创建了运行配置,但是当我尝试设置如果将JRE替换为6,则“运行”按钮将被阻止。 Are they not compatible or am I missing a step?
它们不兼容,还是我错过了一步? I've also tried changing the PATH destination, though I'm not sure if that is even relevant to my problem.
我也尝试过更改PATH目标,尽管我不确定这是否与我的问题有关。
EDIT: I am using a JAR package from an online source that is Java 6 compatible and am trying to integrate it into Eclipse Mars with Java 8 installed. 编辑:我正在使用Java 6兼容的在线资源中的JAR包,并尝试将其集成到安装了Java 8的Eclipse Mars中。
Did you try just adding the external JAR to the project? 您是否尝试过仅将外部JAR添加到项目中? Most (non-executable) JARs that were originally made for older versions of java should still work today.
最初为较旧的Java版本制作的大多数(不可执行)JAR仍应在今天运行。
To add an external JAR: right-click on your project in the package explorer and go to Build Path >> Add External Archives...
then select your JAR from there. 要添加外部JAR,请执行以下操作:在包资源管理器中右键单击您的项目,然后转到
Build Path >> Add External Archives...
然后从那里选择您的JAR。 Be sure to leave the project set up for JRE8. 确保将项目设置为JRE8。
The reason that your run
button is blocked out when you switched to JRE6 was because Eclipse detected that it was not installed and therefore cannot run it as JRE6. 切换到JRE6时,
run
按钮被阻止的原因是Eclipse检测到未安装它,因此无法将其作为JRE6运行。
A few items to check, under Project settings: (most of these can be set workspace-wide as well) 在“ 项目设置”下需要检查的几项:(其中大多数都可以在工作区范围内进行设置)
System: 系统:
Check Installed JREs and Execution environments. 检查已安装的JRE和执行环境。 Make sure a JRE is linked to the Execution Environment for JavaSE-1.6 (with the checkbox).
确保将JRE链接到JavaSE-1.6执行环境(带有复选框)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.