Categories
Eclipse

Requirement: Install the JDK First

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

  1. 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.

  1. 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:

C:\ProgramData\Oracle\Java\javapath

… 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:

  1. Right-click the Start button.

  2. Click Control Panel.

  3. Click System and Security.

  4. Click System.

  5. Click Advanced System Settings.

  6. In the System Properties dialog that appears, click Advanced > Environment Variables.

  7. 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.

  1. Add the following string the end of the Path statement (i.e., to the Path System environment variable).

    ;%JAVA_HOME%\bin\

Note: The \bin directory contains the executable file java.exe.

Categories
Eclipse

Eclipse Cookbook

This cookbook is intended to be used for installing and configuring the Eclipse Integrated Development Environment (IDE) on Windows 10. I used Eclipse as part of my content management system because it allowed me to integrate a Git plugin (which in turn allowed me to version-control my content), and it allowed me to use the markdown editor plugin.

Key concepts

Before I go into the details, I thought it best to explain a few Eclipse concepts first.

Workbench

The term Workbench refers to the desktop development environment. The Workbench aims to achieve seamless tool integration and controlled openess by providing a common paradigm for the creation, management, and navigation of workspace resources. Each Workbench window contains one or more Perspectives. Perspectives contain Views and Editors, and control what appears in certain menus and tool bars. More than one Workbench window can exist on the desktop at any given time.

Workspace

Workspace is a conceptual construct. It’s a container for a multiple Eclipse projects.

Note: You must separate your Git repo from your Workspace (no overlap). Both are constructs for organizing project files, and conceptually, both exist in an abstraction layer on top of the file system. It’s important to understand the difference here because you’ll run into trouble later if you don’t keep the two paradigms separate.