Setting up new Java compiler and runtime in Eclipse IDE

This article will present migrating Eclipse development environment from one version of Java to another in general but Java 6 to java 7 in particular.

Also, it will show you way to configure the Java compiler and runtime in Eclipse IDE for Java / Java EE.

Setup compiler and runtime at global level

By default in the eclipse, all projects uses the same compiler and runtime setting which is configured at global level. The term global level, we will use it here for common setting for all Java projects.

Set up compiler

While installing/setting up the Eclipse IDE on machine for first time, you may notice that you don’t require the JDK to be configured for Eclipse IDE. But It needs the JRE (it gets from default JRE for machine)  and still Eclipse will compile and run our all the Java projects

This is because Eclipse IDE has in built incremental compiler which is packed with JDT(Java Development Tools). So we don’t need to give path to javac and so forth.

The Eclipse JDT tooling has way to change the compiler using the which, Eclipse call it as Compiler Compliance level. It indicates which JDK level, source code should conform to.

By default, initially JDT will set the compiler level according to JRE you configured initially while starting it for first time.

Now, do following to configure compiler for Java projects

Under Menu, Go to Windows > Preferences >> Java >> Compiler


Press shortcut key – Ctrl + 3 > type “compiler” >> choose “Compiler-Java “ under Preferences category  as shown below

after this you will have

Now, change the compiler level of your choice as shown below, in this case we will change to 1.7 from Compiler compliance level dropdown

Setup runtime

For running the eclipse itself it requires the Java Runtime and it finds using path variable or registries or value of “-vm” param in eclipse.ini file and after that it automatically configures this JRE by default for all Java project

Under Menu, Go to Windows > Preferences > Java > Installed JRE


Press shortcut key – Ctrl + 3 > Type “Installed” > Select Installed JRE under Preferences category as shown below

after this you will see following

You can add the new JRE at using Add button which tell you to browse for JRE installation folder as shown in following figures

After this you can select the new JRE, in our case jre7.

Note that, you can select only one JRE from configured ones from Installed JRE.

Setup new compiler and runtime for existing project

By doing above configuration make sure the new compiler and runtime for new Java projects.

For existing projects, you need to do changes in the project specific properties after the above configuration

Following are the steps required

  • Change the library from build path

  • make sure check for using generic/global level compiler compliance level

  • Build the project

Change the library from build path

You need to change the JRE system library from build path for that project, which is shown as follows

Go to projects Build Path by right click on project > Build Path > Go to Configure Build Path…

Select JRE library and hit the Edit button from right side buttons and it will open up the dialog box for the changing the JRE library


Now, select the either Alternate JRE radio button and change to jre7 from dropdown

or you can select third radio button, Workspace default JRE, which will use the jre7 for our case


Click  OK on this pane and again on build path pane as shown in following figure

Compiler compliance level

For a particular project, if you are configured the Project specific for Java compiler compliance level, make sure it will use the global configuration or you can make it to use the level as 1.7. You can check it for as shown as follows

Go to Project , right click go to Properties menu > Java Compiler as shown as follows

Above shows the project properties pane, on right select the Java compiler and then if you are ticked “Enable project specific setting “, then untick that, otherwise ignore this step

Build the project

After all above steps, build the project in Eclipse.which will use the new Compiler level and JRE.

If you are doing Build automatically, then project is already built after you changed the project. 

Now, you will have the all projects in your Eclipse IDE using the newly configured Java compiler and runtime.

One thought on “Setting up new Java compiler and runtime in Eclipse IDE

Add yours

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: