Installing OpenJDK 11 on Linux(Azure) using yum or wget - java

I want to install & configure openjdk 11 on Linux(vm in azure devops) either by yum or wget , i am new, not sure i tried using wget but openjdk 11 is not downloading
Need OpenJDK 11 to run Sonarqube

According to this post here: https://superuser.com/questions/1466580/unable-to-download-oracle-jdk-8-using-wget-command
"Following a licensing change of Oracle Java on 16 April 2019, Oracle now forbids anyone from downloading Java outside of their approved process.
That process is currently to log in to an Oracle account, accept the new license, then attempt the download with the authentication cookies in place."
In order to download it now you must use apt-get command if you use ubuntu or debian so on.
I know it says java 8 but this applies to all java versions
EDIT: I do not use centos so I cannot personally test this but try if this works
$ sudo yum install java-11-openjdk-devel
or
$ sudo yum install java-11-openjdk

You can try below scripts to install jdk 11 on azure linux vm.
sudo rpm --import http://repos.azul.com/azul-repo.key
sudo curl http://repos.azul.com/azure-only/zulu-azure.repo -o /etc/yum.repos.d/zulu-azure.repo
sudo yum -q -y update
sudo yum -q -y install zulu-11-azure-jdk
See here for more information.

Related

JRE not found on Ubuntu 20.04

I tried to install java 11 on ubuntu 20.04 vps using this tutorial how to install java on ubuntu 20.04
But after installation and done setting $JAVA_HOME variable, I can't run a library because libjvm.so was not found.
Turns out jre not exist on $JAVA_HOME for all java version I installed (openjdk, oracle java). Why that happen and how to make jre installed?
Run the following code
$ sudo dpkg --purge "package-name"
Example
$ sudo dpkg --purge jdk-15.0.1
Then install JDK
And at last run the command
$ apt install -f

Upgrading Java and Setting as Default on Raspberry Pi

I'm new to Raspberry-Pi & Linux and I wanted to code up a Minecraft server using PaperMC, but when I ran the server I got a warning saying that Java-11 would no longer be supported in future builds, so I thought it would be easy enough to upgrade to Java-16. I have not found documentation regarding this topic specifically which has led to using parts of differing tutorials, and I think I made a few mistakes. To start, I purged the old Java-11 version like so:
sudo -i
apt-get purge openjdk*
apt-get purge java11*
apt-get autoremove
Then I moved to the jvm directory and installed Java-16 from AdpotOpenJDK:
cd /usr/lib/jvm
wget https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jre_aarch64_linux_hotspot_16.0.1_9.tar.gz
tar xzf OpenJDK16U-jre_aarch64_linux_hotspot_16.0.1_9.tar.gz
export PATH=$PWD/jdk-16.0.1+9-jre/bin:$PATH
java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)
This export PATH command seems to be temporary, when I logout of sudo or exit the command window, and then check java -version again I get that the java command is not found. If I try setting JAVA_HOME & PATH:
export JAVA_HOME="/usr/lib/jvm/jdk-16.0.1+9-jre"
export PATH=$PATH:$JAVA_HOME/bin
The result is also temporary. Why can't I set this Java-16 as the default? Do I need to make a script that runs these commands on startup?
Here is a way to install it permanently using apt. Link to the information
https://paper.readthedocs.io/en/latest/java-update/index.html#debian-ubuntu
$ sudo apt update
$ sudo apt install apt-transport-https software-properties-common gnupg wget
$ wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
$ sudo add-apt-repository https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
$ sudo apt update
$ sudo apt install adoptopenjdk-16-hotspot

How To Configure and Download Java JDK in ubuntu for VS code

I've tried to run vscode in java but the vs code is showing an error of (Not Pointing To JDK).
Is there is any way to run java programs in vs code in ubuntu.
Install java from here Install java from here Install java from here Install java from here Install java from here
https://code.visualstudio.com/docs/java/java-debugging#:~:text=You%20can%20manually%20install%20the,Code%20for%20the%20first%20time.
The simplest way is to run:
sudo apt-get install openjdk- and to press TAB several times for available options.
You will then choose a specific jdk.
Some examples:
sudo apt-get install openjdk-14-jdk
sudo apt-get install openjdk-13-jdk
sudo apt-get install openjdk-11-jdk
Afterwards you can restart VSCode.

Getting issue "Oracle Java (JDK) 8 Installer PPA (DISCONTINUED)" when I am running following command - $sudo add-apt-repository ppa:webupd8team/java

Getting issue "Oracle Java (JDK) 8 Installer PPA (DISCONTINUED)" when I am running following command -
sudo add-apt-repository ppa:webupd8team/java
when I run
sudo apt-get install oracle-java8-installer
I get
Unable to locate package oracle-java8-installer
This was a change in Oracle JDL Licence agreement. https://launchpad.net/~webupd8team/+archive/ubuntu/java
I was setting up the Ubuntu VM machine on cloud. What should be a workaround?
If there is no specific reason to use JDK 8, you may try 11. Have you tried using PPA from linuxuprising?
If JDK 11 works for you, you can use this:
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-installer
And for the JDK 12 you can use from the same source again (here is the link), or basically do this:
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java12-installer

Install JDK with apt-get on ubuntu precise 64

I'm trying to install Java JDK 8 with this instruction:
apt-get update -y
apt-get install -y python-software-properties
add-apt-repository ppa:webupd8team/java
apt-get update -y
apt-get install -y oracle-java8-installer
but I get a 404 while I'm running last command:
Connecting to download.oracle.com
(download.oracle.com)|95.101.180.41|:80... connected. HTTP request
sent, awaiting response... 404 Not Found 2017-10-18 10:33:03 ERROR
404: Not Found.
download failed
How many days since this problems happens? It is strange a 404 for a Java installer. Isnt'it? Any workaround?
You can try to install java 8 manually.
Just download java (tar.gz) from oracle site.
Then, create directory for your jdk like (of course if folder doesn't exist)
$/opt/jdk
and extract java into created folder.
$tar -zxf jdk-8u152-linux-x64.tar.gz -C /opt/jdk
Then, it is very important, to set it as the default JVM in your machine run.
Just use that command:
$update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_152/bin/java 100
and
$update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_152/bin/javac 100
Now, verify that java installed correctly.
$java -version
A new SDK version is out and the old version is no longer available. Wait for a updated package, install manually or use OpenJDK.

Categories

Resources