Saturday, February 28, 2015

Configure JAVAC and JAVA in Linux

Download Java SE 7 JDK for Linux x86 archive. At the time of writing, the file I'm using is jdk-7u21-linux-i586.tar.gz, but the filename will change as updates are released.
    Apparently there is no longer a jvm folder, so create one.

    sudo mkdir /usr/lib/jvm

    Move the archive to the jvm folder

    
 sudo mv jdk-7u21-linux-i586.tar.gz /usr/lib/jvm/

    Change to the jvm folder and extract the JDK from the archive

    cd /usr/lib/jvm

    sudo tar zxvf jdk-7u21-linux-i586.tar.gz

    Everything will be extracted to a new jdk1.7.0_21 folder and you can delete
the archive file now.
  
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6.31-oracle/bin/javac" 1
sudo update-alternatives --config javac
  
similarly for java use java

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6.31-oracle/jre/bin/java" 1
sudo update-alternatives --config java

Double-check the version
    java -version

No comments:

Post a Comment