How to Set Up Java on Your Personal Desktop/Laptop
.
If you want to program using Java, you're going to need a Java Development Kit (JDK) and a Java Runtime Environment (JRE) in order to compile and run the code. This document will take you through the steps needed in order to get Java installed and the PATH variables set. First, you will need to download a version of Java. For this, we will be using AdoptOpenJDK, which is the version of Java used on all of the CSCI classroom machines. You can find the installer here: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot The version we’ll be using is OpenJDK 11 (LTS; Long Term Support) with JVM HotSpot9 (already selected in the above link). After you have downloaded the installer, run it. During the install process you’ll want to keep all the default settings but make sure to select the install option for “Set JAVA_HOME variable,” as this allows programs to locate where the JDK and JRE are installed. After that, proceed with the install. Once the install is finished, everything should be good to go. However, if you want to double check your installation, there are a couple of commands that you can type in to a command prompt. First, open up a command prompt. Next, type Java -version <-- this will let you know what JDK version you have installed Javac -version <-- this will let you know what JRE version you have installed If for some reason the numbers don’t match, please make sure that you do not have other versions of Java installed. If you do, you should remove those from your computer via Add/Remove Programs, from System Settings or from the Control Panel . You can also check the PATH variable to make sure it’s pointing to the correct Java directory (this was one of the default settings for the AdoptOpenJDK installer so it should be correct, but it doesn’t hurt to double check). In the list for the PATH variables, you should see an entry that points to the bin folder of the Java installation. The entry should look similar to what’s below: C:\Program Files\AdoptOpenJDK\jdk-11.0.4.11-openj9\bin To get to the PATH Variables, follow the steps below: If you have a “This PC” icon on your desktop, right click on it and select Properties (bottom of the menu) Or Go to Start and type Control Panel into the search bar. From there, click on the System Icon to get access to the System properties (Changing the View By option from Category to Large/Small icons may help you find the System icon more easily) Once in System Properties, on the left you’ll want to click on the link for Advanced System Settings There, you’ll want to click the button for 'Environment Variables' In the System variables window, in the lower half of the dialog box, look for PATH (it should be the fifth or sixth entry from the top of the list) Highlight it and click on the Edit button, below the list This will bring up a window with a list of entries. These entries specify where executables are located. In this list, you should see the entry for your Java installation, specifically the bin folder where the Java executable resides (C:\Program Files\AdoptOpenJDK\jdk-11.0.4.11-openj9\bin). If you do not see that entry, you will need to manually enter it. The easiest way to do that is to navigate to the bin folder inside the install directory and then click on the folder icon, in the address bar of the File Explorer window, and copy the address (PATH) that appears and paste it into the Path variables list. Once the PATH variable has been set, and you’ve confirmed that both the JDK and JRE version numbers match, you should be good to go, as far as beginning/continuing your Java programming experience.