Machine Specs:
- Ubuntu Server 12.04.1 LTS 64-bit
Installing OpenJDK7:
sudo apt-get install openjdk-7-jdkUse "java -version" to check what version java is being used.
You may have multiple versions of JDK installed. Run update-alternatives to choose the java version.
sudo update-alternatives --config java
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
Choose 2 when it prompts.
2) To find out where Java is installed:
which java
3) Setting JAVA_HOME
sudo vi ~/.bashrc
append "export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" to .bashrc and save the filesource ~/.bashrc
source ~/.bashrc
echo $JAVA_HOME
Make sure you are modifying ~/.bashrc as root. If you are doing it as a user (ex. ubuntu), the root will not have JAVA_HOME set.
No comments:
Post a Comment