0

My Windows 10 machine is an HP EliteBook 840 G6 running i5-8365U. I recently installed Ubuntu 20.04.3 LTS as a VM on VirtualBox 6.1.28. The ISO file ubuntu-20.04.3-desktop-amd64.iso was from https://ubuntu.com/download/desktop.

I have to choose a JDK 8 (LTS) from AdoptOpenJDK, HotSpot JVM, update 265. This is on the second page of https://adoptopenjdk.net/archive.html?variant=openjdk8&jvmVariant=hotspot. The associated files can be found by search this age for string "265".

There are many Linux options to choose from:

  Linux ppc64le
  Linux s390x
  Linux x64
  Linux arm32
  Linux aarch64

I'm guessing that I choose "x64" because my Ubuntu ISO file name contains "amd64"?

I'm not sure if this is an Ubuntu question or a VM question.

Flow
  • 2,476

3 Answers3

1

If you are unsure of your system architecture, you can use the uname -m or arch command from a terminal. If you get x86_64 -> It's a x64.
You can refer to this answer for more details.

On a side note, as you have probably noticed, AdoptOpenJDK has transitioned to Eclipse and https://adoptopenjdk.net won't be updated as of July 2021. The new website is https://adoptium.net, and the distribution name is now "Temurin". That said, if you specifically need a 265 build, Adoptium does not provide it and you better stick with AdoptOpenJDK.

Flow
  • 2,476
1

I think you may have a X-Y problem, namely that all you really want is a JVM for your system.

tl;dr sudo apt install default-jdk

As suggested by running java on a Ubuntu 20.04 LTS WSL instance:

tra@Thunder:~$ java

Command 'java' not found, but can be installed with:

sudo apt install openjdk-11-jre-headless # version 11.0.11+9-0ubuntu2~20.04, or sudo apt install default-jre # version 2:1.11-72 sudo apt install openjdk-16-jre-headless # version 16.0.1+9-1~20.04 sudo apt install openjdk-8-jre-headless # version 8u292-b10-0ubuntu1~20.04 sudo apt install openjdk-13-jre-headless # version 13.0.7+5-0ubuntu1~20.04 sudo apt install openjdk-17-jre-headless # version 17+35-1~20.04

In other words, you have several already available in the Ubuntu package system. Note that if you actually need to compile programs, you need more like the javac Java compiler.

tra@Thunder:~$ javac

Command 'javac' not found, but can be installed with:

sudo apt install openjdk-11-jdk-headless # version 11.0.11+9-0ubuntu2~20.04, or sudo apt install default-jdk # version 2:1.11-72 sudo apt install openjdk-16-jdk-headless # version 16.0.1+9-1~20.04 sudo apt install openjdk-8-jdk-headless # version 8u292-b10-0ubuntu1~20.04 sudo apt install openjdk-13-jdk-headless # version 13.0.7+5-0ubuntu1~20.04 sudo apt install openjdk-17-jdk-headless # version 17+35-1~20.04 sudo apt install ecj # version 3.16.0-1

Unnless you have very specific requirements there are very good odds that the default-jdk will do what you need.

sudo apt install default-jdk

(answer Yes, and watch the downloads pass by)

Then

tra@Thunder:~$ javac --version
javac 11.0.11
tra@Thunder:~$ java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
0

As per matigo's comment, "If you are using the 64-bit ISO (supported by Intel/AMD processors), then you'll want x64."

I didn't actually have to download from the adoptopenjdk site https://adoptopenjdk.net/archive.html?variant=openjdk8&jvmVariant=hotspot and try to figure out the installation. Instead, I found Bash instructions at https://gist.github.com/phillipsj/950235f411dec9e0e90e199c6dde12e9 to "wget" the tarball and install it:

# install-openjdk-8.sh
#---------------------
wget -q https://github.com/AdoptOpenJDK/openjdk8-releases/releases/download/jdk8u172-b11/OpenJDK8_x64_Linux_jdk8u172-b11.tar.gz
tar -xf OpenJDK8_x64_Linux_jdk8u172-b11.tar.gz
sudo mkdir /usr/lib/jvm && sudo mv jdk8u172-b11 /usr/lib/jvm/jdk8u172-b11
export JAVA_HOME=/usr/lib/jvm/jdk8u172-b11
export PATH=/usr/lib/jvm/jdk8u172-b11/bin
java -version

I modified it for the URL of the tarball for my version, as found on the adoptopenjdk site, and fixed some pathologies that I experienced:

cd ~/tmp
wget -q https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u265-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u265b01.tar.gz
tar -xf OpenJDK8U-jdk_x64_linux_hotspot_8u265b01.tar.gz

Did next steps manually in case version string

in the file name had a different pattern.

They didn't, so just replace jdk8u172-b11 with jdk8u265-b01.

Can't just paste the lines en masse to the Bash prompt cuz

"sudo" wants password from keyboard, so separate the compound line.

sudo mkdir /usr/lib/jvm sudo mv jdk8u265-b01 /usr/lib/jvm/jdk8u265-b01

The following exports probably need to go into ~/.profile or

some-such. I need to know which ~/.* file to put it in and/or

why ~/.profile isn't run after a "su - user-name". For now,

manually source ~/.profile after "su".

export JAVA_HOME=/usr/lib/jvm/jdk8u265-b01 export PATH="$PATH:/usr/lib/jvm/jdk8u265-b01/bin" java -version

openjdk version "1.8.0_265" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_265-b01) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.265-b01, mixed mode)

which java javac

/usr/lib/jvm/jdk8u265-b01/bin/java /usr/lib/jvm/jdk8u265-b01/bin/javac