- HowTo Update Java Version Linux Step by Step Guide
- Update Java Version Linux Procedure
- Update Java Version
- Related Articles
- How to upgrade Java on Ubuntu?
- 7 Answers 7
- How to Check and Update Java Version on Ubuntu 22.04?
- How to check Java version on Ubuntu 22.04
- How to Update Java version on Ubuntu 22.04
- Conclusion
- About the author
- Anees Asghar
- How to Upgrade Oracle Java on Ubuntu Linux
- 32-bit Oracle Java instructions:
- 64-bit Oracle Java instructions:
- Modify your Linux system PATH:
HowTo Update Java Version Linux Step by Step Guide
Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to data centers, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!. In this article we are going to see HowTo Update Java Version Linux Step by Step Guide.
Update Java Version Linux Procedure
# java -version java version "1.7.0_141" OpenJDK Runtime Environment (rhel-2.6.10.1.el7_3-x86_64 u141-b02) OpenJDK 64-Bit Server VM (build 24.141-b02, mixed mode)
Existing Java Version is 1.7.0_141 and we are going to update to 1.8.0_144, Is that simple
Download extra package file from Java site using wget command, below package is 64 bit
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz"
32 bit Java Download method is below
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-i586.tar.gz"
To Download Java directly from command line use below method visit java download link provided above, right click on required package click on Copy Link Address
Login to Terminal and add below strings before download link (Update Java Version Linux)
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "PASTE URL"
Extract Java Downloaded Package for Update Java Version. Use tar command
# cd /opt/java # tar -xvf jdk-8u144-linux-x64.tar.gz
Update Java Version
run Update Java Version command to Update existing Java Package version
]# update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_144/bin/java ]# update-alternatives --config java There are 3 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64/jre/bin/java) 2 /usr/java/jdk1.8.0_144/jre/bin/java 3 /opt/java/jdk1.8.0_144/bin/java Enter to keep the current selection[+], or type selection number: 3
Let’s add variable path to Java
# export JAVA_HOME=/opt/java/jdk1.8.0_144/ # export JRE_HOME=/opt/java/jdk1.8.0_144/jre # export PATH=$PATH:/opt/java/jdk1.8.0_144/bin:/opt/java/jdk1.8.0_144/jre/bin
# java -version java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Update Java Version Linux is completed successfully. Java Version is now 1.8
Related Articles
Thanks for your wonderful Support and Encouragement
More than 40000 Techies in our community do you want part of it Join Now
My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn MoreView all Posts
How to upgrade Java on Ubuntu?
I installed Ubuntu on my computer, and now my Java version is not updated. I have Java, so I don’t need to install — just update the current version. Can someone please tell me the command I have to use to get the current version? I have tried: apt-get update and apt-get upgrade .
7 Answers 7
Note: WebUpd8 team’s PPA has been discontinued with effective from April 16, 2019. Thus this PPA doesn’t have any Java files. More information can be found on PPA’s page on Launchpad. Hence this method no longer works and exists because of historical reasons.
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java8-installer
If you ABSOLUTELY need to have the latest update of java you must manualy install from official source, follow this tuto : http://www.cyberciti.biz/faq/howto-installing-oracle-java7-on-ubuntu-linux/
But I advise you to wait as ppa update
I tried this one but it will not install the newest version. I have checked it out on java-website. I have now version 7 update 65 and I want version 7 update 67.
root@ubuntu:/home/kenneth# sudo apt-get install oracle-java7-installer Reading package lists. Done Building dependency tree Reading state information. Done oracle-java7-installer is already the newest version. 0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
Found something useful here..
Installing Java with apt-get is easy. First, update the package index:
Check if Java is not already installed:
sudo apt-get install default-jre sudo apt-get install default-jdk
This worked great for me in March 2016. my system is always fairly up-to-date so just the last two commands (the install s) did it for up
Note: WebUpd8 team’s PPA has been discontinued with effective from April 16, 2019. Thus this PPA doesn’t have any Java files. More information can be found on PPA’s page on Launchpad. Hence this method no longer works and exists because of historical reasons.
The newest OpenJDK Java packaged for trusty (14.04) right now is 7u55. You can check your Java version with java -version from the command line in Terminal.
If you want a newer one your best options will be to:
- wait for an update from Ubuntu, OR
- install the Oracle distribution of Java which currently is at 7u65:
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer
How to Check and Update Java Version on Ubuntu 22.04?
Java is a general-purpose client-side programming language that serves several functionalities like android application development, game development, web applications development, and many other software products. To build any application, first, we have to install Java on our computer systems. However, some applications are not capable to run on java’s outdated version. So, it’s essential to know which Java version is installed on our operating system and if our machine is running an outdated version of java, then how to update it.
This post will explain how to check and upgrade the Java version on Ubuntu 22.04. So, let’s begin!
How to check Java version on Ubuntu 22.04
Open the terminal on your ubuntu 22.04 operating system and type the below-mentioned command to check which Java version is installed on your machine:
Once you typed the above-given command on the terminal, it will produce the following outcome:
The above snippet shows that Java is not installed on our machine. Now, let’s move one step further to learn how to install/upgrade the Java version on Ubuntu 22.04.
How to Update Java version on Ubuntu 22.04
To update the java version or to install the latest java version, firstly you have to upgrade the apt repository. To do so, type the below-given command on the terminal:
Next, run the below-enlisted command to install the default Java Runtime Environment(JRE) on your operating system:
When you execute the above-given command, it will work like this:
Type “Y” to continue the installation process:
The whole installation process will take a few minutes to install JRE on your system. You can verify the JRE’s installation by typing the following command:
If JRE is successfully installed on your Ubuntu 22.04, then you will witness the result something like this:
Congratulations! You have successfully installed the latest and updated version of Java on Ubuntu 22.04.
As the JRE’s installation is done, now you can run almost every java software on your machine. However, some java-oriented software may require the Java Development Kit(JDK) to compile/run some particular tasks. In such cases, you can install the JDK by typing the below-given command:
The above-given command will work something like this:
Type “Y” to continue the JDK’s installation process:
Type the below-given command on the terminal of ubuntu 22.04 to verify whether the updated JDK is installed on your machine or not:
You will witness the below-given output:
Congrats! You are running an updated Java version on your ubuntu 22.04.
Conclusion
Open the terminal and type “sudo apt install default-jre” to install JRE, and type “sudo apt install default-jdk” to install JDK on ubuntu 22.04. To check or verify the java version type “java -version” on the terminal of Ubuntu 22.04. This write-up provided a step-by-step guide on how to check, update, and verify the java version on ubuntu 22.04.
About the author
Anees Asghar
I am a self-motivated IT professional having more than one year of industry experience in technical writing. I am passionate about writing on the topics related to web development.
How to Upgrade Oracle Java on Ubuntu Linux
wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 13 people, some anonymous, worked to edit and improve it over time.
This article has been viewed 297,865 times.
This document is intended to assist with the upgrade of the many new release versions of Oracle Java JDK/JRE on Ubuntu Linux. Every so often, due to bug fixes and security issues Oracle releases updates to their version of the Java JDK/JRE.
- Note: This article presumes you have a version of Oracle Java 7 either 32-bit or 64-bit located in /usr/local/java and you want to upgrade to a new version of Oracle Java. If you don’t please see the following article for more information:
- How to Install Oracle Java on Ubuntu Linux
- jdk-7u40-linux-i586.tar.gz (32-bit)
- jre-7u40-linux-i586.tar.gz (32-bit)
or - jdk-7u40-linux-x64.tar.gz (64-bit)
- jre-7u40-linux-x64.tar.gz (64-bit)
32-bit Oracle Java instructions:
- Type/Copy/Paste: cd /home/«your_user_name»/Downloads
- Type/Copy/Paste: sudo cp -r jdk-7u40-linux-i586.tar.gz /usr/local/java
- Type/Copy/Paste: sudo cp -r jre-7u40-linux-i586.tar.gz /usr/local/java
- Type/Copy/Paste: cd /usr/local/java
- Type/Copy/Paste: sudo tar xvzf jdk-7u40-linux-i586.tar.gz
- Type/Copy/Paste: sudo tar xvzf jre-7u40-linux-i586.tar.gz
64-bit Oracle Java instructions:
- Type/Copy/Paste: cd /home/«your_user_name»/Downloads
- Type/Copy/Paste: sudo -s cp -r jdk-7u40-linux-x64.tar.gz /usr/local/java
- Type/Copy/Paste: sudo -s cp -r jre-7u40-linux-x64.tar.gz /usr/local/java
- Type/Copy/Paste: cd /usr/local/java
- Type/Copy/Paste: sudo tar xvzf jdk-7u40-linux-x64.tar.gz
- Type/Copy/Paste: sudo tar xvzf jre-7u40-linux-x64.tar.gz
At this point you should have two new uncompressed binary directories in /usr/local/java for the Java JDK/JRE listed as:
jdk1.7.0_40
jre1.7.0_40
jdk1.7.0_25
jre1.7.0_25
Modify your Linux system PATH:
- Type/Copy/Paste: sudo gedit /etc/profile
or - Type/Copy/Paste: sudo nano /etc/profile
Scroll down using your arrow keys to the end of the file and add the following lines below to the end of your /etc/profile file in Ubuntu Linux,at this point you are going to be changing the version numbers from the old Oracle Java to the new version of Java, you will change the versions numbers in the following system PATH file /etc/profile:
Modify the /etc/profile file:
JAVA_HOME=/usr/local/java/jdk1.7.0_25
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JRE_HOME=/usr/local/java/jre1.7.0_25
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
Change to this:
JAVA_HOME=/usr/local/java/jdk1.7.0_40
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JRE_HOME=/usr/local/java/jre1.7.0_40
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
Save the file and exit