How to config Oracle java on your Ubuntu

install via ppa source
sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

sudo update-java-alternatives -s java-8-oracle


install via jdk gz downloaded from Oracle


sudo mkdir /usr/lib/jvm

sudo tar -zxvf jdk-8u121-linux-i586.tar.gz -C /usr/lib/jvm

sudo vim ~/.bashrc

#set oracle jdk environment
export JAVA_HOME=/usr/lib/jvm/java-8-oracle ## change to your jdk folder
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

source ~/.bashrc

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-oracle/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-8-oracle/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java-8-oracle/bin/jar 300  
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java-8-oracle/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java-8-oracle/bin/javap 300  

sudo update-alternatives --config java
chose your jdk path.

No comments:

Post a Comment

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...