0

I have downloaded Oracle JDK 11 and I'm trying to install it on my Linux Mint (x64). After downloading the tarball, I extracted it to my /usr/lib/jvm and exported it to PATH:

export PATH=$PATH:/usr/lib/jvm/jdk-11.0.5/bin/java 

but if I try to:

java -version 

bash says:

zsh:command not found: java 

There are something that I'm missing?

1 Answer 1

0

If you run which java, you will see that it's linked to /usr/bin/java, which is a symlink to /etc/alternatives/java. To change the default java version, you need to run the update-alternatives command. You will see output similar to this:

 $ update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode Press <enter> to keep the current choice[*], or type selection number: 

Now, since you installed via a tarball and not a PPA (as Oracle Java is not part of the Mint repos), this method for Oracle Java won't work since the java installation is not registered with the system. If you plan on switching between Java versions, I would recommend finding a PPA and installing that way.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.