How Can I Tell Eclipse to Compile and Build a Project with a Different JRE Version than it Normally Does?

霸气de小男生 提交于 2019-12-01 15:54:22
gutch

Yes, this is possible. You can install as many different versions of Java — JREs and JDKs — as you like, and tell Eclipse which one to use for each project.

First step is to install the JDK 1.5 on your machine (JDK is short for 'Java [SE] Development Kit', look for that on the Oracle download site). The JDK includes a JRE, so to make life easier you can usually just install the JDK and not worry about the JRE/JDK distinction.

Second step is to tell Eclipse about the new JDK. Go to Preferences... then Java > Installed JREs. Click the Search... button and Eclipse should find your newly installed JDK 1.5 and add it to the list.

Final step is to allocate that JDK 1.5 to your project. Bring up the Properties menu for your project (right-click it). Then set these values:

  • Java Compiler tab
    • Tick Enable project specific settings
    • Set Compiler Compliance level to 1.5
  • Java Build Path tab, Libraries subtab
    • Find the JRE System Library item, click Edit...
    • Set Alternate JRE to your newly installed JDK 1.5

It looks like you are using JRE 1.5 rather than JDK 1.5

Make sure you download the JDK 1.5 and your issue should go away. You can set the default JDK in the preferences, search for 'jre'.

Projects can also define their specific jre

Get JDK 1.5 from Here http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!