Linux update java version

Updating java version to 8 on ubuntu

I would like to update my java version (UPDATE, not install) on my ubuntu 12.04 computer. I currently have java 7.x, and I would like to update it to the newest version possible (8.0 at least) without it being too complicated.

6 Answers 6

Java 8 is not available in the Ubuntu 12.04 repositories, but it is available from a Launchpad PPA.

You also cannot update a Java version to the next Java version, but you can install different Java versions side by side.

To install Java version 8 (OpenJDK 8 edition — not ORACLE Java 8) open a terminal and execute :

sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-8-jdk 

If you only want to install the Java Runtime Environment :

sudo apt-get install openjdk-8-jre 

As you said «. without it being too complicated . «, I assumed that you installed Java 7 from the Ubuntu repositories, which contain OpenJDK and did not add the WebUpd8 PPA (ORACLE Java).

As you said that you get the File «/usr/bin/add-apt-repository», line 37 print _(«The %s named ‘%s’ has no PPA named ‘%s'» ^ SyntaxError: invalid syntax error, have a look here.

Suggestion :

Keep both versions installed side by side, some other packages or programs might rely on Java 7.

However, when you don’t want to have both versions and if don’t need Java 7 anymore . remove it.

It says that I cannot add the PPA: File «/usr/bin/add-apt-repository», line 37 print _(«The %s named ‘%s’ has no PPA named ‘%s'» ^ SyntaxError: invalid syntax

As you did not specify whether you want to install OpenJDK or Oracle JDK, my answer covers Oracle JDK.

It is interesting to quote this text from here. What follows applies to JDK8 too and for all Ubuntu versions of yours or higher.

Oracle JDK7 itself is not hosted in the PPA because that’s not allowed by the new Java license (which is also the reason why it has been removed from the official Ubuntu repositories); the package in the PPA automatically downloads Oracle Java JDK 7 from its official website and installs it on your Ubuntu / Linux Mint computer, just like the flashplugin-installer package does.

Note that JDK9 is expected to be released during this year, so do not try to use before that.

For this reason, this is is how to install (and not update) your Java 8 version:

sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-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.

Читайте также:  Linux red hat kvm

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.

Источник

Installing or Updating Java

Installing Java is a critical first step to using or developing plugins for Paper, Velocity, and Waterfall. This guide will walk you through the recommended installation steps for most major platforms.

Читайте также:  Astra linux группа netdev

Do not use headless variants of Java!

There are headless variants of Java which usually have a suffix of -headless in their package name. Those variants miss required dependencies for Paper. Therefore, using them is not recommended.

This guide focuses on Amazon’s Corretto OpenJDK distribution. This is because it offers the best installation experience on the most platforms. Corretto is, however, not the only OpenJDK vendor to choose from. Many alternatives exist such as Eclipse Adoptium, Microsoft and Azul Zulu. Note that the JDK Oracle distributes, while functionally identical, is not recommended due to an extremely unfriendly installer and previous hostile licensing.

Linux​

Ubuntu/Debian​

Installing Java 17 on Debian-based Linux distributions is very simple. First, ensure your system has all required tools to successfully install Java.

sudo apt-get update && sudo apt-get upgrade sudo apt-get install software-properties-common ca-certificates apt-transport-https gnupg curl 

Second, import the Amazon Corretto public key and apt repository.

curl https://apt.corretto.aws/corretto.key | sudo apt-key add - sudo add-apt-repository 'deb https://apt.corretto.aws stable main' 

Then, install Java 17 and other dependencies using the following command:

sudo apt-get update sudo apt-get install -y java-17-amazon-corretto-jdk libxi6 libxtst6 libxrender1 

RPM-based​

To install Java 17 on CentOS, RHEL, Fedora, openSUSE, SLES, or any other RPM-based Linux distribution, execute the following commands depending on your package manager. Once you have finished, precede to verify your installation.

DNF​

DNF is used on Fedora, CentOS/RHEL 7+, and related distributions.

sudo rpm --import https://yum.corretto.aws/corretto.key sudo curl -Lo /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo sudo dnf -y install java-17-amazon-corretto-devel 

Zypper​

Zypper is used on openSUSE, SLES, and related distributions.

sudo zypper addrepo https://yum.corretto.aws/corretto.repo sudo zypper refresh sudo zypper install java-17-amazon-corretto-devel 

YUM​

YUM is used on older releases of CentOS/RHEL, and excessively old releases of Fedora.

sudo rpm --import https://yum.corretto.aws/corretto.key sudo curl -Lo /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo sudo yum -y install java-17-amazon-corretto-devel 

Windows 10 & 11​

If you’re on Windows 10 or 11, installing Java is just like installing any other program. Download the Amazon Corretto installer from their website.

Once you have run the installer, it is safe to click «next» through the whole process. No additional bloatware or toolbars will be installed, and all the required features are enabled out of the box.

Now, open a command prompt and precede to verify your installation.

macOS/OS X​

If you’re on macOS, the best way to manage Java installations is with a tool called Homebrew. Follow the instructions on their homepage to install it. Then, in your terminal run the following command:

Once this command has completed, continue to verify your installation.

Pterodactyl​

On Pterodactyl versions lower than 1.2.0 , an administrator account is required to change the Java version. These instructions will not apply.

If you have started a Paper server with an incorrect Java version, Pterodactyl will automatically prompt you to update like this:

Pterodactyl Automatic Prompt

If this does not show up for you, the Java version can be manually changed. Navigate to the «Startup» tab of your server, select ghcr.io/pterodactyl/yolks:java_17 from the «Docker Image» dropdown as shown in the image below.

Pterodactyl Manual Java Version Change

The Verifying Installation section does not apply for Pterodactyl.

Verifying Installation​

Now that you have installed Java 17, run this command in your terminal to ensure the process was successful.

The output should be similar to this. The important parts to look out for is that it starts with openjdk 17 and contains 64-Bit in the last line. If the output you get is similar to java: command not found , try creating a new terminal session.

openjdk 17 2021-09-14 LTS OpenJDK Runtime Environment Corretto-17.0.0.35.1 (build 17+35-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.0.35.1 (build 17+35-LTS, mixed mode, sharing) 

If your installation has failed, do not hesitate to reach out in the #paper-help channel of our Discord for support.

Источник

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 

Источник

Оцените статью
Adblock
detector