Expand Authors Top

If you have a few years of experience in the Java ecosystem and you’d like to share that with the community, have a look at our Contribution Guidelines.

November Discount Launch 2022 – Top
We’re finally running a Black Friday launch. All Courses are 30% off until next Friday:


November Discount Launch 2022 – TEMP TOP (NPI)
We’re finally running a Black Friday launch. All Courses are 30% off until next Friday:


Expanded Audience – Frontegg – Security (partner)
announcement - icon User management is very complex, when implemented properly. No surprise here.

Not having to roll all of that out manually, but instead integrating a mature, fully-fledged solution - yeah, that makes a lot of sense.
That's basically what Frontegg is - User Management for your application. It's focused on making your app scalable, secure and enjoyable for your users.
From signup to authentication, it supports simple scenarios all the way to complex and custom application logic.

Have a look:

>> Elegant User Management, Tailor-made for B2B SaaS

1. Overview

In the Java ecosystem, as the new releases of JDK are introduced at least once a year, we'll probably need to switch to a newer version at some point.

In this quick tutorial, we'll show how to check the available JREs, add a JRE to Eclipse, and change a Java version in an Eclipse project, so we'll be ready when that time comes.

2. Check Whether the JRE Is Available in Eclipse

After being sure that we have installed the version that we want to use, we'll need to ensure that it's available to use in Eclipse.

Let's take a look at Window -> Preferences, and within that, Java -> Installed JREs:

window preferences before adding jre extended window 1

If the JRE we want is listed, then we're good to go.

But, suppose we need to use JRE 9, 10, or 11. Since we only have JDK 8 installed, we'll have to add it to Eclipse.

3. Adding a JRE to Eclipse

Next, from the Window -> Preferences dialog, let's click the Add… button. From here, we need to specify the JRE type. We'll choose Standard VM:

add jre standard vm option 1

And finally, let's specify the location of the new JRE (under the JRE home) and click Finish:

add jre with location 1

As a result, we now have two JREs configured in our IDE:

new jre added 2

4. Change the Java Version of Our Project

Now, let's suppose that we were using Java 8 in our project and now we want to change it to Java 10:

project in project tree before changing jdk

First, we'll navigate to the Project properties and then to the Java Build Path:

project with java8 before changing jdk 1

and hit the Remove button on the existing JRE:

java build path empty 1

Now, we'll use the Add Library button and choose the JRE System Library:

add library window 2

Let's choose JavaSE-10 from the JDK that we recently installed and click the Finish button:

jre system library window 1

Now, as we can see, we've correctly configured our project's Java Build Path:

java build path after change to java 10 1

We need to do one additional step — make sure we're using the correct Compiler Compliance Level for the Java Compiler:

java compiler after switch 1

In our case it says Java 10, so we're all good:

project with java 10

In case the Compiler Compliance Level is not the correct one, we can simply uncheck the Use compliance from execution environment option and choose the correct one.

5. Conclusion

In this quick article, we learned how to add a new JRE into our Eclipse workspace and how to switch to a different Java version in our current Eclipse project.

November Discount Launch 2022 – Bottom
We’re finally running a Black Friday launch. All Courses are 30% off until next Friday:


Generic footer banner
Comments are closed on this article!