Skip to content

Instantly share code, notes, and snippets.

@chrisdchristo
Created December 28, 2013 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdchristo/8159712 to your computer and use it in GitHub Desktop.
Save chrisdchristo/8159712 to your computer and use it in GitHub Desktop.
101: Java 7

101: Java

Current Version: 1.7.0_09-b05 x64

Download the lastest version from Oracle. You want Java 7 SE edition:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

You want the JDK version as this will include the JRE as well. Oracle require you to accept an agreement to download so you won't be able to wget the link from your server. So download it to your local machine and SCP it. Get the Linux x64 tar.gz version.

scp jdk-7u10-linux-x64.tar.gz chris@mydomain.com:

Once you've sent it, log on via SSH:

ssh chris@mydomain.com

if you have upgrade to the latest Debian then the /usr/lib64 folder might not be there anymore. It might have been merged with /usr/lib.

if /usr/lib64 exists then un tar the file to here:

tar zxvf jdk-7u10-linux-x64.tar.gz -C /usr/lib64/jvm/

If /usr/lib64 doesn't exist then un tar to here:

tar zxvf jdk-7u10-linux-x64.tar.gz -C /usr/lib/jvm/

You will want to update your $JAVA_HOME and $JRE_HOME variables:

export JAVA_HOME##/usr/lib/jvm/jdk1.7.0_10
export JRE_HOME##/usr/lib/jvm/jdk1.7.0_10

add these to your /etc/profile file so all users have this.

If you have multiple versions of java on your system (you might have version 1.6), then you need to utilize update-alternatives to set your local java and javavc commands:

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_10/bin/java 1065
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_10/bin/javac 1065

1065 is a priority number and higher means more important so we want this number to be higher than our java6 install. We can check this by:

update-alternatives --config java

Finally let's make sure that the java and javac commands point to the new version:

java -version
javac -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment