`

install JDK from source

 
阅读更多

1. download jdk.

 

2. 

#!/bin/sh

JV=jdk1.7.0_55
#tar -xvf jdk-7*
sudo mkdir -p /usr/lib/jvm
sudo mv ./${JV} /usr/lib/jvm/

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/${JV}/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/${JV}/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/${JV}/bin/javaws" 1

sudo chmod a+x /usr/bin/java 
sudo chmod a+x /usr/bin/javac 
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/${JV}

 

 3. Run

   

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

 

 4. JAVA HOME

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_55

 

  or

  5. 

#JAVA_HOME=/usr/java
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_51
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics