Which Version of Java Should You Use?
• stackchief •
Update (February 15, 2021): Java 11 remains most recent version featuring long term support (LTS) while Java 15 offers promising new features.
Update (March 29, 2020): Java 14 is the latest stable release and shows promising new features. BUT REMEMBER it will not offer long term support (LTS). For these reasons, LTS support editions are only recommendations for production releases including Java SE 8 and Java SE 11.
Java SE 11 was released in September 2018 and will be the next major version with long term support (LTS).Java SE 8 remains the preferred production standard in 2019. While both 9 and 10 have been released, neither will be offering LTS.
Since it's first release in 1996, Java has maintained a reputation for being one of the most secure, reliable, and platform independent languages for computer programming. Despite its popularity, getting started with Java can be overwhelming. With all the different versions and editions to choose from, it can be difficult to know which version of Java is right for you. In this article, we discuss the relevant versions of Java available including key differences and the version that’s most appropriate for your needs.
Preface: Versions vs Editions
When you download Java, you'll often see different options for "Java SE 7" or "Java EE 8" While the number clearly indicates the version number, the letters tend to confuse newcomers. These letters specify the edition of Java you are using. The most common editions of Java include:
Standard Edition (SE)
The standard edition is the core Java programming platform. It includes all of the core libraries and APIs that every Java programmer needs to be familiar with. For most developers (especially those just getting started) the standard edition is the most appropriate.
Enterprise Edition (EE)
The enterprise edition includes everything found in the standard edition with some additional libraries providing functionality for large-scale enterprise environments. The enterprise edition emphasizes large, fault-tolerant, distributed apps which characterize an enterprise environment.
While EE is appropriate for big business and large scale projects, it's added functionality is not necessary for newcomers or individual developers looking to get their feet wet.
Micro Edition (ME)
The micro edition provides a subset of the functionality that comes with SE, however it includes some additional libraries specific to mobile development. This edition is most appropriate for mobile device Java developers.
Which Version of Java Should I Use?
In today's world, there are 3 versions of Java that you'll commonly run across:
Java 7 was originally launched in 2011. It remained the default download option from April 2012 to October 2014 and is still used widely today. Java 7 was most popular for improved type checking, improved type inference for generics , and JVM support for dynamic languages.
Despite it's popularity, Java 7 is no longer publicly supported by Oracle.
Oracle officially stopped posting updates for Java 8 after September 2016.
Java 9 was released in 2017 and is the main publicly supported version of Java used today. Java 9 takes a more modular approach to programming as code is more clearly separated based on functionality. Additionally, Java 9 introduces JShell: a command line tool allowing you to run standalone Java code in an interactive shell for quick testing. It also includes micro benchmarking allowing developers to measure performance of small pieces of code. It includes full support for HTTP 2.0 client and even features a new process API.
Java 10 was released in March of 2018. It's improvements include a garbage-collector interface and local variable type inference, however it doesn't offer long term support (LTS).
Java 11 was released in September of 2018. It is the next major version of Java offering LTS.
Developer Version vs Product Version
After installing Java, you can run java -version to see which version you have installed. You may see something like java version "1.8.0_71". This is considered the developer version whereas the product version would be 8.0. It's all the same thing...
JDK vs JVM vs JRE
Java requires a runtime environment to execute the code you write. When you download Java, you also get the Java Runtime Environment (JRE). This JRE includes a Java Virtual Machine (JVM) which is an abstract computing machine that enables your computer to run a Java program.
The Java Developer Kit (JDK) is a development environment that you download for developing Java applications. It includes the JRE as well as an interpreter, compiler, and other tools for debugging and development. You'll need the JDK to develop Java applications, but not to run them. This is because the JRE is included with Java installs.
If you're just getting your feet wet with Java then installing either Java SE 8 or Java SE 11 is your best bet. While other editions like EE add extra functionality, the SE has all of the essential libraries you need. While you'll see earlier versions of Java (5,6,7) in the real world, remember that 8 is the actively supported version today. You'll want to install the JDK if you want to write and compile your own Java applications but the JRE is all you need to run existing Java apps.