====== Install java 7 on linux by hand ======
**Upgrading the alternatives system for a just downloaded Java**
The best and more complete instructions I have found are these: http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7
I reproduce them for just in case the other site dissapears the entry.
[[InstallJdk8AlternativesUbuntu|The same for Java 8]]
===== Download and uncompress java =====
Download the java binaries and uncompress them. Let's say you have downloaded into /usr/java.
Oracle guys usually install it on /usr/java, creating two links: default and latest, who points to the just installed java version.
So, the current java version will be in /usr/java/default
===== Create an alteratives system for the new java =====
Create a file /usr/java/current/.java-1.7.0-oracle.jinfo with the following content:
alias=java-7-oracle
priority=100
section=non-free
jre ControlPanel /usr/lib/jvm/java-7-oracle/jre/bin/ControlPanel
jre java /usr/lib/jvm/java-7-oracle/jre/bin/java
jre java_vm /usr/lib/jvm/java-7-oracle/jre/bin/java_vm
jre javaws /usr/lib/jvm/java-7-oracle/jre/bin/javaws
jre jcontrol /usr/lib/jvm/java-7-oracle/jre/bin/jcontrol
jre keytool /usr/lib/jvm/java-7-oracle/jre/bin/keytool
jre pack200 /usr/lib/jvm/java-7-oracle/jre/bin/pack200
jre policytool /usr/lib/jvm/java-7-oracle/jre/bin/policytool
jre rmid /usr/lib/jvm/java-7-oracle/jre/bin/rmid
jre rmiregistry /usr/lib/jvm/java-7-oracle/jre/bin/rmiregistry
jre unpack200 /usr/lib/jvm/java-7-oracle/jre/bin/unpack200
jre orbd /usr/lib/jvm/java-7-oracle/jre/bin/orbd
jre servertool /usr/lib/jvm/java-7-oracle/jre/bin/servertool
jre tnameserv /usr/lib/jvm/java-7-oracle/jre/bin/tnameserv
jre jexec /usr/lib/jvm/java-7-oracle/jre/lib/jexec
jdk appletviewer /usr/lib/jvm/java-7-oracle/bin/appletviewer
jdk apt /usr/lib/jvm/java-7-oracle/bin/apt
jdk extcheck /usr/lib/jvm/java-7-oracle/bin/extcheck
jdk idlj /usr/lib/jvm/java-7-oracle/bin/idlj
jdk jar /usr/lib/jvm/java-7-oracle/bin/jar
jdk jarsigner /usr/lib/jvm/java-7-oracle/bin/jarsigner
jdk java-rmi.cgi /usr/lib/jvm/java-7-oracle/bin/java-rmi.cgi
jdk javac /usr/lib/jvm/java-7-oracle/bin/javac
jdk javadoc /usr/lib/jvm/java-7-oracle/bin/javadoc
jdk javah /usr/lib/jvm/java-7-oracle/bin/javah
jdk javap /usr/lib/jvm/java-7-oracle/bin/javap
jdk jconsole /usr/lib/jvm/java-7-oracle/bin/jconsole
jdk jdb /usr/lib/jvm/java-7-oracle/bin/jdb
jdk jhat /usr/lib/jvm/java-7-oracle/bin/jhat
jdk jinfo /usr/lib/jvm/java-7-oracle/bin/jinfo
jdk jmap /usr/lib/jvm/java-7-oracle/bin/jmap
jdk jps /usr/lib/jvm/java-7-oracle/bin/jps
jdk jrunscript /usr/lib/jvm/java-7-oracle/bin/jrunscript
jdk jsadebugd /usr/lib/jvm/java-7-oracle/bin/jsadebugd
jdk jstack /usr/lib/jvm/java-7-oracle/bin/jstack
jdk jstat /usr/lib/jvm/java-7-oracle/bin/jstat
jdk jstatd /usr/lib/jvm/java-7-oracle/bin/jstatd
jdk native2ascii /usr/lib/jvm/java-7-oracle/bin/native2ascii
jdk rmic /usr/lib/jvm/java-7-oracle/bin/rmic
jdk schemagen /usr/lib/jvm/java-7-oracle/bin/schemagen
jdk serialver /usr/lib/jvm/java-7-oracle/bin/serialver
jdk wsgen /usr/lib/jvm/java-7-oracle/bin/wsgen
jdk wsimport /usr/lib/jvm/java-7-oracle/bin/wsimport
jdk xjc /usr/lib/jvm/java-7-oracle/bin/xjc
plugin xulrunner-1.9-javaplugin.so /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so
plugin mozilla-javaplugin.so /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so
Run this script:
update-alternatives --quiet --install /usr/lib/xulrunner-addons/plugins/libjavaplugin.so xulrunner-1.9-javaplugin.so /usr/java/default/jre/lib/amd64/libnpjp2.so 100
update-alternatives --quiet --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /usr/java/default/jre/lib/amd64/libnpjp2.so 100
update-alternatives --quiet --install /usr/bin/appletviewer appletviewer /usr/java/default/bin/appletviewer 100 --slave /usr/share/man/man1/appletviewer.1 appletviewer.1 /usr/java/default/man/man1/appletviewer.1
update-alternatives --quiet --install /usr/bin/apt apt /usr/java/default/bin/apt 100 --slave /usr/share/man/man1/apt.1 apt.1 /usr/java/default/man/man1/apt.1
update-alternatives --quiet --install /usr/bin/extcheck extcheck /usr/java/default/bin/extcheck 100 --slave /usr/share/man/man1/extcheck.1 extcheck.1 /usr/java/default/man/man1/extcheck.1
update-alternatives --quiet --install /usr/bin/idlj idlj /usr/java/default/bin/idlj 100 --slave /usr/share/man/man1/idlj.1 idlj.1 /usr/java/default/man/man1/idlj.1
update-alternatives --quiet --install /usr/bin/jar jar /usr/java/default/bin/jar 100 --slave /usr/share/man/man1/jar.1 jar.1 /usr/java/default/man/man1/jar.1
update-alternatives --quiet --install /usr/bin/jarsigner jarsigner /usr/java/default/bin/jarsigner 100 --slave /usr/share/man/man1/jarsigner.1 jarsigner.1 /usr/java/default/man/man1/jarsigner.1
update-alternatives --quiet --install /usr/bin/javac javac /usr/java/default/bin/javac 100 --slave /usr/share/man/man1/javac.1 javac.1 /usr/java/default/man/man1/javac.1
update-alternatives --quiet --install /usr/bin/javadoc javadoc /usr/java/default/bin/javadoc 100 --slave /usr/share/man/man1/javadoc.1 javadoc.1 /usr/java/default/man/man1/javadoc.1
update-alternatives --quiet --install /usr/bin/javah javah /usr/java/default/bin/javah 100 --slave /usr/share/man/man1/javah.1 javah.1 /usr/java/default/man/man1/javah.1
update-alternatives --quiet --install /usr/bin/javap javap /usr/java/default/bin/javap 100 --slave /usr/share/man/man1/javap.1 javap.1 /usr/java/default/man/man1/javap.1
update-alternatives --quiet --install /usr/bin/jconsole jconsole /usr/java/default/bin/jconsole 100 --slave /usr/share/man/man1/jconsole.1 jconsole.1 /usr/java/default/man/man1/jconsole.1
update-alternatives --quiet --install /usr/bin/jdb jdb /usr/java/default/bin/jdb 100 --slave /usr/share/man/man1/jdb.1 jdb.1 /usr/java/default/man/man1/jdb.1
update-alternatives --quiet --install /usr/bin/jhat jhat /usr/java/default/bin/jhat 100 --slave /usr/share/man/man1/jhat.1 jhat.1 /usr/java/default/man/man1/jhat.1
update-alternatives --quiet --install /usr/bin/jinfo jinfo /usr/java/default/bin/jinfo 100 --slave /usr/share/man/man1/jinfo.1 jinfo.1 /usr/java/default/man/man1/jinfo.1
update-alternatives --quiet --install /usr/bin/jmap jmap /usr/java/default/bin/jmap 100 --slave /usr/share/man/man1/jmap.1 jmap.1 /usr/java/default/man/man1/jmap.1
update-alternatives --quiet --install /usr/bin/jps jps /usr/java/default/bin/jps 100 --slave /usr/share/man/man1/jps.1 jps.1 /usr/java/default/man/man1/jps.1
update-alternatives --quiet --install /usr/bin/jrunscript jrunscript /usr/java/default/bin/jrunscript 100 --slave /usr/share/man/man1/jrunscript.1 jrunscript.1 /usr/java/default/man/man1/jrunscript.1
update-alternatives --quiet --install /usr/bin/jsadebugd jsadebugd /usr/java/default/bin/jsadebugd 100 --slave /usr/share/man/man1/jsadebugd.1 jsadebugd.1 /usr/java/default/man/man1/jsadebugd.1
update-alternatives --quiet --install /usr/bin/jstack jstack /usr/java/default/bin/jstack 100 --slave /usr/share/man/man1/jstack.1 jstack.1 /usr/java/default/man/man1/jstack.1
update-alternatives --quiet --install /usr/bin/jstat jstat /usr/java/default/bin/jstat 100 --slave /usr/share/man/man1/jstat.1 jstat.1 /usr/java/default/man/man1/jstat.1
update-alternatives --quiet --install /usr/bin/jstatd jstatd /usr/java/default/bin/jstatd 100 --slave /usr/share/man/man1/jstatd.1 jstatd.1 /usr/java/default/man/man1/jstatd.1
update-alternatives --quiet --install /usr/bin/native2ascii native2ascii /usr/java/default/bin/native2ascii 100 --slave /usr/share/man/man1/native2ascii.1 native2ascii.1 /usr/java/default/man/man1/native2ascii.1
update-alternatives --quiet --install /usr/bin/rmic rmic /usr/java/default/bin/rmic 100 --slave /usr/share/man/man1/rmic.1 rmic.1 /usr/java/default/man/man1/rmic.1
update-alternatives --quiet --install /usr/bin/schemagen schemagen /usr/java/default/bin/schemagen 100 --slave /usr/share/man/man1/schemagen.1 schemagen.1 /usr/java/default/man/man1/schemagen.1
update-alternatives --quiet --install /usr/bin/serialver serialver /usr/java/default/bin/serialver 100 --slave /usr/share/man/man1/serialver.1 serialver.1 /usr/java/default/man/man1/serialver.1
update-alternatives --quiet --install /usr/bin/wsgen wsgen /usr/java/default/bin/wsgen 100 --slave /usr/share/man/man1/wsgen.1 wsgen.1 /usr/java/default/man/man1/wsgen.1
update-alternatives --quiet --install /usr/bin/wsimport wsimport /usr/java/default/bin/wsimport 100 --slave /usr/share/man/man1/wsimport.1 wsimport.1 /usr/java/default/man/man1/wsimport.1
update-alternatives --quiet --install /usr/bin/xjc xjc /usr/java/default/bin/xjc 100 --slave /usr/share/man/man1/xjc.1 xjc.1 /usr/java/default/man/man1/xjc.1
update-alternatives --quiet --install /usr/bin/java-rmi.cgi java-rmi.cgi /usr/java/default/bin/java-rmi.cgi 100
update-alternatives --quiet --install /usr/bin/ControlPanel ControlPanel /usr/java/default/jre/bin/ControlPanel 100
update-alternatives --quiet --install /usr/bin/java java /usr/java/default/jre/bin/java 100
update-alternatives --quiet --install /usr/bin/java_vm java_vm /usr/java/default/jre/bin/java_vm 100
update-alternatives --quiet --install /usr/bin/javaws javaws /usr/java/default/jre/bin/javaws 100
update-alternatives --quiet --install /usr/bin/jcontrol jcontrol /usr/java/default/jre/bin/jcontrol 100
update-alternatives --quiet --install /usr/bin/keytool keytool /usr/java/default/jre/bin/keytool 100
update-alternatives --quiet --install /usr/bin/pack200 pack200 /usr/java/default/jre/bin/pack200 100
update-alternatives --quiet --install /usr/bin/policytool policytool /usr/java/default/jre/bin/policytool 100
update-alternatives --quiet --install /usr/bin/rmid rmid /usr/java/default/jre/bin/rmid 100
update-alternatives --quiet --install /usr/bin/rmiregistry rmiregistry /usr/java/default/jre/bin/rmiregistry 100
update-alternatives --quiet --install /usr/bin/unpack200 unpack200 /usr/java/default/jre/bin/unpack200 100
update-alternatives --quiet --install /usr/bin/orbd orbd /usr/java/default/jre/bin/orbd 100
update-alternatives --quiet --install /usr/bin/servertool servertool /usr/java/default/jre/bin/servertool 100
update-alternatives --quiet --install /usr/bin/tnameserv tnameserv /usr/java/default/jre/bin/tnameserv 100
update-alternatives --quiet --install /usr/bin/jexec jexec /usr/java/default/jre/lib/jexec 100
And after that, run ''update-alternatives --config java.
===== Set the JAVA_HOME and JAVA_ROOT for all users =====
In the ''/etc/profile.d'' directory, add these files:
**alljava.csh**
#
# /etc/profile.d/alljava.csh
#
#
# This script sets some environment variables for default java.
# Affected variables: JAVA_BINDIR, JAVA_HOME, JRE_HOME,
# JDK_HOME, SDK_HOME
#
setenv JAVA_ROOT /usr/java/default
setenv JAVA_HOME /usr/java/default
setenv JAVA_BINDIR /usr/java/default/bin
**alljava.sh**
#
# /etc/profile.d/alljava.sh
#
export JAVA_ROOT=/usr/java/default
export JAVA_HOME=/usr/java/default
export JAVA_BINDIR=/usr/java/default/bin
unset JDK_HOME
unset SDK_HOME