Java Specification Versions:
Here are the major releases:
- Java 1.0 (January 1996) – The original version.
- Java 1.1 (February 1997) – Introduced several significant features, including the JavaBeans API.
- Java 2 (J2SE 1.2) (December 1998) – Introduced the
Swing
application framework.
- J2SE 1.3 (May 2000) – Introduced the
HotSpot
JVM.
- J2SE 1.4 (February 2002) – Introduced regular expressions, image I/O API, and more.
- Java SE 5 (J2SE 1.5) (September 2004) – Introduced generics, metadata annotations, enumerated types, and more.
- Java SE 6 (December 2006) – Introduced scripting support, JVM improvements, and more.
- Java SE 7 (July 2011) – Introduced the
try-with-resources
statement, the diamond operator, and more.
- Java SE 8 (March 2014) – Introduced lambdas, streams, and the
java.time
package.
- Java SE 9 (September 2017) – Introduced the module system.
- Java SE 10 (March 2018) – Introduced local-variable type inference (
var
).
- Java SE 11 (September 2018) – Introduced
String::lines
, isBlank
, and other methods, plus the java.net.http
HttpClient.
- Java SE 12 (March 2019) – Introduced switch expressions (preview) and more.
- Java SE 13 (September 2019) – Introduced text blocks (preview) and more enhancements.
- Java SE 14 (March 2020) – Introduced pattern matching for
instanceof
(preview) and other improvements.
- Java SE 15 (September 2020) – Continued the introduction and enhancement of several features.
- Java SE 16 (March 2021) – Introduced sealed classes (preview) and other enhancements.
- Java SE 17 (September 2021) – This version is an LTS (Long Term Support) release, which means it will receive updates for a longer period than the interim releases.
- Java SE 18 (March 2022)
- Java SE 19 (September 2022)
- Java SE 20 (March 2023)
- Java SE 21 (September 2023)
Java has moved to a time-driven release model, with new versions being released every six months. Not all of these are long-term support (LTS) versions. As of Java 17, the LTS versions have been Java 8, Java 11, and Java 17.
Downloading and Installing Java from OpenJDK
if you want to download OpenJDK manually, download it from https://jdk.java.net/
But you can download JDK programmatically as the following. Java SE 7, 8, 9, 10, 11, 12, 13 are included below script. So, run below script in your terminal.
# Java SE 7
wget https://download.java.net/openjdk/jdk7u75/ri/openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz
# Java SE 8
wget https://download.java.net/openjdk/jdk8u40/ri/openjdk-8u40-b25-linux-x64-10_feb_2015.tar.gz
# Java SE 9
wget https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz
# Java SE 10
wget https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz
# Java SE 11
wget https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
# Java SE 12
wget https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_linux-x64_bin.tar.gz
# Java SE 13
wget https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz
mkdir /usr/lib/jvm
# Extract all downloaded jdk files
tar -xvzf openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz -C /usr/lib/jvm
tar -xvzf openjdk-8u40-b25-linux-x64-10_feb_2015.tar.gz -C /usr/lib/jvm
tar -xvzf openjdk-9.0.4_linux-x64_bin.tar.gz -C /usr/lib/jvm
tar -xvzf openjdk-10.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm
tar -xvzf openjdk-11.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm
tar -xvzf openjdk-12.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm
tar -xvzf openjdk-13_linux-x64_bin.tar.gz -C /usr/lib/jvm
# Remove downloaded jdk files
rm openjdk*
# Install Java and Java Compiler to Environment
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-se-7u75-ri/bin/java 1
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-se-7u75-ri/bin/javac 1
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-se-8u40-ri/bin/java 2
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-se-8u40-ri/bin/javac 2
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-9.0.4/bin/java 3
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-9.0.4/bin/javac 3
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-10.0.2/bin/java 4
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-10.0.2/bin/javac 4
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11.0.2/bin/java 5
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-11.0.2/bin/javac 5
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-12.0.2/bin/java 6
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-12.0.2/bin/javac 6
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-13/bin/java 7
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-13/bin/javac 7
# Verify Java and Java Compiler Installation
# check if java command is pointing to correct path in system
update-alternatives --display java
update-alternatives --display javac
# List all environment variables
update-alternatives --get-selections
# or
update-alternatives --get-selections | grep java
# or
update-alternatives --get-selections | grep ^java
Check Java Version
# Verify if Java is running
java -version
# Verify if Java Compiler is running
javac -version