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

后端 未结 2 1589
刺人心
刺人心 2021-01-17 16:21

I\'m not sure if this question has been answered in full or if my title is descriptive enough given my situation, but I\'ve been asked to convert a project from being built

2条回答
  •  -上瘾入骨i
    2021-01-17 16:55

    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

提交回复
热议问题