Created
April 20, 2013 14:00
-
-
Save Leegorous/5426079 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before run this script, run sudo ls, type your password | |
sudo mkdir -p /usr/lib/jvm | |
sudo tar xvzf ./jdk-7u21-linux-x64.tar.gz -C /usr/lib/jvm | |
cd /usr/lib/jvm | |
sudo mv jdk1.7.0_21 java-7-sun | |
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-sun/bin/java 300 | |
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-sun/bin/javac 300 | |
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java-7-sun/bin/jar 300 | |
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java-7-sun/bin/javah 300 | |
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java-7-sun/bin/javap 300 | |
# if you have more than one jdk installed | |
# | |
# sudo update-alternatives --config java | |
# config paths | |
# | |
echo "export JAVA_HOME=/usr/lib/jvm/java-7-sun">> ~/.bashrc | |
echo "export JRE_HOME=\${JAVA_HOME}/jre">> ~/.bashrc | |
echo "export CLASSPATH=.:\${JAVA_HOME}/lib:\${JRE_HOME}/lib">> ~/.bashrc | |
echo "export PATH=\${JAVA_HOME}/bin:\$PATH">> ~/.bashrc | |
source ~/.bashrc | |
# test | |
# | |
java -version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment