Getting Java

Where you get Java from does depend on your operating system platform and whether you are installing a development environment. I will leave IDEs for another day and focus on the basic Java Virtual Machine (JVM) here.

The first question is, do you just need the Java Runtime Environment (JRE) or do you need the Java Development Kit (JDK) as well. Generally you can easily answer this yourself, although some software actually needs a full JDK, so check the software's system requirements. You may be aware that the software you want uses Java and some software vendors choose to bundle this themselves and hence deploy it as part of their installer into their own directory tree.

Next is the question of how to get Java. With Linux you would be well advised to use your distribution's package manager and standard deployment mechanism, though which you will probably get Oracle's OpenJDK. With Windows or Mac you will need to visit Java SE - Downloads | Oracle Technology Network | Oracle and download what you need. However you would be well advised to read Java CPU and PSU Releases Explained to understand the different releases but in general stick to the "CPU" releases, which are the odd numbered versions.

It is worth highlighting that IBM have their own JVM called J9, which supports their hardware platforms and is it the core of the WebSphere solutions.

The AdoptOpenJDK project provides prebuilt OpenJDK binaries from a fully open source base and you can find more details at AdoptOpenJDK - Open source, prebuilt OpenJDK binaries. It is important to note that OpenJDK is the open source reference implementation that oracle and others use and that the AdoptOpenJDK project is backed by Amazon, IBM, Microsoft, Red Hat and others, as well as the developer community.

It is important to note that Oracle no longer provide free updates for commercial use of Java 8 or Java 11, which are the LTS (Long Term Support) releases. You can pay for this service from Oracle, but a good alternative is AdoptOpenJDK.



Make sure your JAVA_HOME environment variable points to the root directory of the JDK, so on Windows some thing like C:\Dev\Java\jdk1.8.0_111 or wherever you installed it. This means that on Windows %JAVA_HOME%\bin\java -version will work. With recent versions of Java the installer sorts out the path for you but otherwise you can set it as follows: %JAVA_HOME%\bin.


Use your package manager, anything else will just be a world of pain. However your JAVA_HOME might not be set, so you will either need to do this in your profile or look at your distribution documentation for setting it system wide. Most Linux distributions have a number of versions of Java installed or support this and also provide easy ways to switch but this is usually done with soft links, so finding your home dircetory can involve following a number of links! On an Ubuntu box I did this export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 and then $JAVA_HOME/bin/java -version works just fine.


If you go to Oracle's website you can download a DMG file for your Mac and install this, however most people recommend using brew to do this so
brew cask info java will tell you all about the version brew will install by default. In June 2018 this was Java 10 but I needed Java 8, so this would have been no good. If you do this: brew tap caskroom/versions and then do brew cask search java you will see java8 and java6 appear as options.
After this I could then do brew cask install java8 and everything worked. Brew defaults to installing the latest sable version and does not allow old versions, then the extra command to get these other versions working.

I have not used this myself but it you need multiple versions of Java on your Mac then read Multiple JVM versions on macOS.

Old Versions

If you need to work with an old version of Java, then here are some things to note:

  • Most recent Linux distributions use OpenJDK, which was initially based on JDK 7 and has a retro fitted Java 6 version
  • Working with an old Linux distribution that is not currently supported and hence its repositories have gone is a huge pain
  • Downloading old Linux JDKs from Oracle and trying to get them working is far from trival, I failed
  • Windows is actually easier to get old version of Java working on
Hopefully my recent experience will become a thing of the past and clearly things change but my notes might help.