JDK 9 reached yesterday,and I downloaded the jdk-9_linux-x64_bin.tar.gz.
directory
xx@xx:/usr/lib/jvm/jdk-9$ ls
bin conf include jmods legal lib README.html release
It and java8 are very different. I like to configure the same as java8,
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_25
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
But java9 has no jre. So I configured it like that (Add these in the .bashrc file)
export JAVA_HOME=/usr/lib/jvm/java-9
export CLASSPATH=.:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
and run source ~/.bashrc
But java version is still no change. My operating system is Ubuntu 14.04.3.
Did i do anything wrong?
Installation and Configuration of JDK9 is step by step given below:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer
sudo apt-get install oracle-java9-set-default
Changed in .bashrc, /etc/environment and also set default using
3 sections to change java configuration.
export JAVA_HOME=/usr/lib/jvm/java-9-oracle
export PATH=$JAVA_HOME/bin:$PATH
JAVA_HOME="/usr/lib/jvm/java-9-oracle"
PATH=$PATH:$JAVA_HOME/bin
Then run the following command and set
sudo update-alternatives --config java
sudo update-alternatives --config javac
Then run the command
source /etc/environment
java -version
echo $JAVA_HOME
which java
which javac
Execute "source /etc/environment" in every shell where you want the variables to be updated:
$ source /etc/environment
Resource Link: https://stackoverflow.com/a/5994031
Just write JAVA_HOME="/usr/lib/jvm/java-9-oracle"
on your /etc/environment
, without the "export"
/etc/environment is supposed to contain a set of environment variables given as key=value pairs. It is not a shell script, so you can't use shell commands such as export in it.
How to properly set JAVA_HOME in /etc/environment
To check if java is properly installed:
$ which java $ which javac
You should get similar output:
/usr/bin/java
Resource Link: https://stackoverflow.com/a/23124805
To remove Oracle JDK completely, run the commands below:
sudo apt-get remove oracle-java9-installer
sudo apt-get remove --auto-remove oracle-java9-installer
sudo apt-get purge oracle-java9-installer
sudo apt-get purge --auto-remove oracle-java9-installer
https://www.howtoinstall.co/en/ubuntu/trusty/tomcat7?action=remove
To install Java 9
on Ubuntu
:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer
To configure, you need to install oracle-java9-set-default
package to make Java 9
default version.
sudo apt-get install oracle-java9-set-default
Similarly, you can install Java 9
using --no-install-recommends
, then Java 9
won't be set as your default version.
sudo apt-get install --no-install-recommends oracle-java9-installer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With