Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Java Program in Eclipse with Older JRE Without Installing

I want my program to work for people with older versions of Java. My program doesn't need any special new features and it should be able to run fine in Java 6. I have Java 8 installed, and I want to know how I would go about compiling my program in Eclipse in an older version of Java without having to install Java 6.

like image 617
JohnDoe Avatar asked Dec 19 '22 05:12

JohnDoe


1 Answers

  • In the Project Explorer view, right-click on the project and then select Properties.
  • Select the Java Compiler page in the in the Properties window.
  • In the JDK Compliance section, select the desired Compiler compliance level.
  • Click Apply and then Ok.

It will automatically compile to the right version

Note this doesn't actually change the version, just that the compiler would be able to enforce the rules that another Java version would. So it should be compatible

For cross verfiying if it is compiled properly with the lower version, 1. Go to properties 2. go to java build path 3. go to libraries, 4. click on JRE System Library-- double click this to see if exceution environment is properly set.

like image 165
EDToaster Avatar answered Apr 28 '23 10:04

EDToaster