Eclipse Java Jdk

Eclipse is a Java-based application and, as such, requires a Java Runtime Environment or Java Development Kit (JRE or JDK) in order to run. Note that on recent versions of Mac, a full JDK needs to be installed, not just a JRE; see instructions below.

Table Of Content

1- JDK vs JRE

The first time you run Eclipse, you need to choose a workspace (a folder that stores your projects). Step 3: Make Sure Eclipse is Running Java 8. Set Eclipse compiler to compliance level 1.8: Window $ rightarrow$ Preferences $ rightarrow$ Java $ rightarrow$ Compiler. Set the compliance level to 1.8. ESC120 Installing and Setting up Java and Eclipse Computer Science Installing and Setting up Java and Eclipse to Create Java Applications Note: Make sure you go to the following sites ONLY listed in here or class webpage. Part1: Java 11. Download JDK8U60 to Install Java Make sure the sites you are downloading for JDK is from Oracle site. Use png with transparent icon in the about dialog of Java EPP (and others if applicable) NEW: 530698: Using weka api: NEW: 526611: win64 version missing: NEW: 498457: FileNotFoundException: org.eclipse.ui3.108.0.v201.jar: NEW: 489296: Improve out-of-box experience for non-english locales: NEW: 386806: New Eclipse Icon not used.

Sydney

JRE: Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on. It also includes browser plugins for Applet execution.
JDK: Software Development Kit, It's the full featured Software Development Kit for Java, including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.
Usually, when you only care about running Java programs on your browser or computer you will only install JRE. It's all you need. On the other hand, if you are planning to do some Java programming, you will also need JDK.
Sometimes, even though you are not planning to do any Java Development on a computer, you still need the JDK installed. For example, if you are deploying a WebApp with JSP, you are technically just running Java programs inside the application server. Why would you need JDK then? Because application server will convert JSP into Servlets and use JDK to compile the Servlets. I am sure there might be more examples.

2- Use JDK instead of JRE

If both JRE and JDK are installed on your computer, the Eclipse will use JRE as a a default tool to build your projects. But some projects or functions force you to use the JDK instead of the JRE. For example, you have a Maven application, and you want to use the 'Maven install' function to package the application into a JAR/WAR file, an error may appear with the message as follows:
My advice: It is best to use the JDK on all projects. Thus, how do you need to configure on Eclipse?
  • Window/Preferences

Eclipse Java Jdk Configuration

If you find that the Eclipse uses JRE, you need to remove JRE and add JDK.
Select the JDK folder on your computer:
Details
Written by Nam Ha Minh
Last Updated on 04 October 2019 Print Email
In this article, I will guide you how to change JDK/JRE that runs Eclipse IDE, on Windows operating system. First, you need to know exactly which version of Java on which Eclipse is running.

1. Find the JDK / JRE that runs Eclipse

In Eclipse, click menu Help > About Eclipse IDEEclipse Java Jdk. Then in the About Eclipse IDE dialog, click the Eclipse Java JdkInstallation Details

Eclipse Java Jdk Download

button. Then in the next screen, click Configuration tab. Wait for a moment while Eclipse is retrieving configuration information, and you will see a screen as below:Find the line that starts with Eclipse java jdk 8–vm and the value in the next line shows the exact path of JDK/JRE on which Eclipse is running. In the above screenshot, you see Eclipse is running on OpenJDK 11.0.2.


2. How to Change JDK / JRE for Eclipse

You know, Eclipse IDE is written in Java so it needs a JDK/JRE installed to run. By default, the first instance of JDK/JRE found in the PATHenvironment variable is used to run Eclipse. Consider a typical value of the PATHenvironment variable like this:In this case, the Java Virtual Machine found in the JAVA_HOME path will run Eclipse IDE. So changing the Java version that run Eclipse is just a matter of updating the value of the JAVA_HOME variable.However, sometimes it doesn’t work like that. You changed JAVA_HOME points to a newer JDK/JRE, but Eclipse still runs under the old one. Why? What happens?There are two reasons:Eclipse
  • An installation of Oracle Java putting its path before your JAVA_HOME, or
  • Your Eclipse IDE is configured to stick with a JDK/JRE in its configuration file.

Let me show you how to change JDK/JRE for Eclipse in both cases.Edit the PATH environment variable on Windows, and you may see a screen as below:Here, an installation of Oracle Java puts the following line before your JAVA_HOME:That means the JDK/JRE found in this path is always used to run Eclipse. Your JAVA_HOME is ignored. So to change, just move your JAVA_HOME before Oracle’s javapath using the Move Up and Move Down buttons; or delete that Oracle’s javapath. Then restart Eclipse and check configuration again to make sure Eclipse is actually running on the JDK/JRE you specified.If that doesn’t work, it’s very likely that your Eclipse is somehow configured to stick with a specific version of Java Virtual Machine in its configuration file.Open the eclipse.ini file in Eclipse’s installation directory in a text editor like Notepad. You may see something like this:Now, you can change the path after the –vm line to point to a different path of JDK, or delete these two lines to use the Java version specified in the PATH system environment variable.Phew! That’s how to change the version of Java virtual machine that powers your Eclipse IDE. I hope you found this article helpful.You can also watch the video version below:

Other Eclipse Tutorials:


About the Author:

Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.