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

后端 未结 2 1590
刺人心
刺人心 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条回答
  • 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
    0 讨论(0)
  • 2021-01-17 16:55

    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

    0 讨论(0)
提交回复
热议问题