This post was to detail how to install Java SE 1.9, but JAVA SE 1.9 has reached end of life. There really isnt any point in installing this version as Oracle are no longer supporting it. The download is still available on their Archive page though, so this page is here for reference.
As stated on the Oracle JDK9 download page:
They will then direct you to their latest Java SE Downloads page, which features their available downloads.
You can also see my steps to download jdk 8, download jdk 11 and download jdk 12 here.
New Features In Java 9
Downloading the JDK for Java 9
Even though Java 9 has reached ‘end of life’, this page is here for those that need to download it for some reason. For example if you have specific code that was created on that version that you may need for testing or upgrade purposes.
Navigate to the Java SE 9 Archive Downloads page, and scroll down till you get to the Java SE Development Kit 9.0.4 for Windows version. You should see a page similar to the below.
What we see here is the Java SE Development Kit version 9.0.4 (sometimes know as Java 9 or Java 1.9). The windows version shows jdk-9.0.4 in the name, also states that its windows, and is for 64 bit computers too. Its an executable that means that once you download it you click to run it and follow the install wizard that appears.
JDK or JRE
Just in case you are not clear on the difference there are usually 2 flavours of Java to chose from per version. If you just want to run existing software written in Java, you would generally only need a Java Runtime Environment or JRE. This provides the libraries needed to run software that has been created with a version of Java up to and including the version you are looking to install. So software written to run on Java 8 will still run on Java 9 JRE.
If you are looking to create your own Java software, either via the command line or through and Integrated Development Environment you would need a Java Development Kit or JDK download. A JDK gives you everything you need to compile and run code, allowing you to create your own software.
Download Java9 For Windows
Clicking on the windows version will present you with the Oracle login screen.
Either log in or register then login, and you the download will immediately start on your machine.
Installing the JDK Version 9
Once the executable installer has downloaded, click on it to begin the install. You may get windows asking you if you want to allow the installer to make changes, so click yes in this case as we know we are doing an install.
You will then be presented with the Java SE Development Kit 9.0.4 64 bit setup screen. Click Next to continue.
You will then see the Java SE Development Kit 9.0.4 64 bit custom setup screen. You would normally just accept the defaults so click next to continue.
Then you will see the confirmation page for installation of the 9.0.4 JRE, so click next to continue.
You will then see the installer splash screen with the progress bar as it installs the Java JDK and JRE.
Once the install is complete you should see the install complete screen confirmation successful installation. Click Close and at that point you are done with the installer.
Checking The Java Environment
To make java accessible from the command link easily, it should be on your system path. You can check this by starting a command prompt and checking. Right click the start button then click command prompt.
At the command prompt, type java -version, and it will show you which version of java is currently setup on your path, or an error if not.
The version shows 1.8.0_221-b11. Whcih shows that our java 9.0.4 has not been added to the system path. This isnt necessarily a problem. We can modify our system path to point to the version of Java that we just installed, or we can follow the steps below to be able to use multiple versions of Java on the same machine by using batch files.
Installing Multiple Versions Of Java
If you want to have multiple version of java available on your computer for some reason, such as you have a piece of software that demands a specific version of java, you can install java just as we have done here, and then use a windows batch file to point to a specific version of java.
Or you may want to point to the jdk instead of the JRE, for instance if you have some specific software that may need to compile code, so as software for developers. in that case what we would do would be to create a windows batch file that would modify the path so that the version of java we require is run instead of what has already been defined on the path.
set path=C:\Program Files\Java\jdk-9.0.4\bin;%path% java -version
We create a windows batch file by opening notepad, and then saving that with a .bat extension. If we then run that we get the below.
This does look the same as before as we havent actually installed an additional version yet, but if we check the path by typing path at the command line we can see that the one we sit is there first now.