Eclipse was written in Java, is hosted in a Java Virtual Machine, and was primarily designed for Java software development. As such, a fundamental requirement for running it is a Java Development Kit (JDK) deployment. The JDK is a superset of the Java Runtime Environment (JRE) – the bits you need in order to run Java applications.
- Get the latest version of the JDK by visiting: Oracle Java SE Downloads. There are several versions to choose from. Which one should you get? I recommend Java Platform, Standard Edition.
- On the Java SE Downloads page, in the section Java Platform, Standard Edition, click JDK Downloads. You land on the Java SE Development Kit 8 Downloads page.
- Accept the license agreement (click the “Accept License Agreement radio button), and then click the download link for the latest version of the Windows x64 release. When the Run/Save toast appears, click Run.
- Accept all defaults except the “install to” location; for that, see the next subsection.
Where to install
I’m going to follow the Linux Filesystem Hierarchy Standard and create an /opt directory on the root of my C: drive; and then I’ll install all of the open source software beneath it. The hope is to create a [somewhat] portable installation.
- The default location was C:\Program Files\Java\jdk1.8.0_60\, but I changed it to C:\opt\Java\jdk1.8.0_60\). I.e., in the fully-qualified path name, simply replace “Program Files” with “opt”.
Note: I was going to truncate the version number from the end of the path name, but I changed my mind: I thought there might be a good reason why Oracle included these details. I kept the version number for these docs because I felt it wasn’t that important that I genericize the docs by using jdkx.x.x_xx.
- Half-way through the JDK installation, the JRE installation begins, and the installer presents you with the option to change the install location from C:\Program Files\Java\jre1.80_66 to a different folder. Again, simply replace “Program Files” with “opt”.
In the case of the JRE, you can’t simply select Program Files and type opt over top of it. You’re forced to navigate a path selection dialog down to “C:\opt\Java”, and create a new folder (“\jre1.8.0_66” in my case).
Note: Interestingly, the installer actually installed three copies of the java runtime.
- C:\opt\Java\jdk1.8.0_66\bin\java.exe (java runtime for private use by the IDE). * Choose this one for your JAVA_HOME in order to get the tools.jar to work!
- C:\opt\Java\jdk1.8.0_66\jre\bin\java.exe (java runtime for private use) * I used to point JAVA_HOME here, but Ant doesn’t work if you do!
- C:\opt\Java\jre1.8.0_66\bin\java.exe (java runtime for public use). Use this one for %JAVA_HOME%.
Note: I also found java.exe in another location:
… and this line was also added to the beginning of my path statement. I don’t know how this got there!?
Setup system environment variables
The use of System Environment Variables makes installations portable. To add new System environment variables:
Right-click the Start button.
Click Control Panel.
Click System and Security.
Click Advanced System Settings.
In the System Properties dialog that appears, click Advanced > Environment Variables.
Add the following two new System environment variables:
POSIX_HOME = C:\opt\
JAVA_HOME = %POSIX_HOME%\Java\jdk1.8.0_66\
Note: In order to get Ant to work properly, you have to set JAVA_HOME to point to the java.exe in the JDK – so Ant can find the file tools.jar.
Add the path to the Java executable to the path system environment variable
Adding the location of application executables to the Path statement makes them portable in that it gives you the flexibility of running pathed executables from any directory.
Add the following string the end of the Path statement (i.e., to the Path System environment variable).
Note: The \bin directory contains the executable file java.exe.