Installare Java su Debian

From RVM Wiki
Revision as of 13:24, 10 October 2015 by Gabriele.vivinetto (talk | contribs)
Jump to navigation Jump to search

Debian 7 Wheezy

  • Usare make-jpkg.

Java 8

  • Se si vuole installare java 8, bisogna usare make-jpkg dai backports
echo "deb http://http.debian.net/debian wheezy-backports main contrib non-free

" | sudo tee -a /etc/apt.sources.list

sudo apt-get update

Installazione make-jpkg

  • Installarlo:
sudo apt-get install java-package lsb-release

Creazione del pacchetto debian

  • Creare il .deb:
make-jpkg jdk-7u45-linux-x64.tar.gz
  • Installarlo:
sudo dpkg -i oracle-j2sdk1.7_1.7.0+update45_amd64.deb

Riferimenti

Debian 5 Lenny

  • Installare i pacchetti
sudo apt-get install sun-java6-jre
  • Impostare SUN Java come default:
sudo update-alternatives --config java

Riferimenti

Debian 4 Sarge

To find out which version is installed, just open up a command line and type java -version in there.

Installing the Sun J2SE on Debian Sarge

First, open a Shell window:

   su 
   <Your root password> 
   cd ../../etc/apt 
   nano -w sources.list 

Add:

   contrib non-free 

To the last three lines, example of finished file:

   #deb file://cdrom/ sarge main 
   deb http://ftp.uk.debian.org/debian/ stable main contrib non-free 
   deb-scr http://ftp.uk.debian.org/debian/ stable main contrib non-free 
   deb http://security.debian.org/ stable/updates main contrib non-free 

Use CTRL+O to write the changes

Back in the Shell window:

   apt-get update 

Now that all this is done, your system is ready to install Java. Grab the non rpm Linux self extracting file from http://java.sun.com/j2se/1.5.0/download.jsp (currently jre-1_5_0_04-linux-i586.bin). Just save it to your /home/<user> directory.

Back in the Shell console:

   apt-get install java-package 

Once installed:

   exit 
   cd ../../home/<user> 
   fakeroot make-jpkg jre-1_5_0_04-linux-i586.bin 

This may take some time... Once done:

   su 
   <Your root password> 
   dpkg -i sun-j2re1.5_1.5.0+update04_i386.deb 

Again, could take a while... finally, once done:

   chown -R root:root /usr/java/jre1.5.0_02/ 
   ln -s /usr/java/jre1.5.0_02/bin/java /usr/bin/java 
   ln -s /usr/java/jre1.5.0_02/bin/java_vm /usr/bin/java_vm 
   cp /etc/bash.bashrc /etc/bash.bashrc_backup 
   vim /etc/bash.bashrc 

Use your favorite editor to add the following lines at the end:

JAVA_HOME=/usr/java/jre1.5.0_02 export JAVA_HOME PATH=$PATH:$JAVA_HOME/bin export PATH

Check all went well with:

   java -version 

Done? Good!