2012/11/27

debianized updating «Ortodox» jdk little howto

  • install jdk/jre for manully usage
  • debianize it

Part one, manual installation:

Download latest jdk or jre from oracle/java.net. At the end of 2012 it should be version 7 update . Copy arhive into  /opt/ directory

extract arhive with tar xfvz jdk.tar.gz and we've get  /opt/jdk1.7.0_09 directory

link  /opt/java should lead us to what we want(jre version 6, 7, or 8)
rm /opt/java && ln -s /opt/jdk1.7.0_09  /opt/java

At this point we we've got some version of jre  and we can easily update them and choose between major Java release for example.

Part two: let's do some debianization. If we have default system java installatin we have link chain, which should be chaged;).
 /usr/bin/java -> /etc/alternatives/java -> /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   


 show which variants we have.
 $ update-alternatives --list java  

ok, let's add our prepaired variant.
 $ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/bin/java" 100  

 and update config:
  $ sudo update-alternatives --config java  

 Here we should choose /opt/java/bin/java  and system will automatically update link chain.
  $ java -version  
 java version "1.7.0_12-ea"  
 Java(TM) SE Runtime Environment (build 1.7.0_12-ea-b01)  
 Java HotSpot(TM) Client VM (build 24.0-b24, mixed mode)  



Ok, now we have oracle java with on debian box. At least we should use JAVA_HOME less often;).