Installare Java su Debian: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Debian 7 Wheezy=
=Debian 7 Wheezy=
* Usare make-jpkg
* Usare make-jpkg, che crea il pacchetto debian usando il .tar.gz scaricato dal sito Oracle


* Installarlo:
==Java 8==
  sudo apt-get install java-package  
 
* 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
sudo apt-get install --t wheezy-backports java-package
 
==Java 7 e Java 6==
 
* Installare la versione stock:
 
  sudo apt-get install java-package
 
==Creazione del pacchetto debian==
* Installare dipendenze:
  sudo apt-get install lsb-release


* Scaricare il pacchetto java che si vuole utilizzare da *[http://www.oracle.com/technetwork/java/javase/downloads/index.html Java SE - Downloads | Oracle Technology Network | Oracle]
* Scaricare il pacchetto java che si vuole utilizzare da *[http://www.oracle.com/technetwork/java/javase/downloads/index.html Java SE - Downloads | Oracle Technology Network | Oracle]

Latest revision as of 13:26, 10 October 2015

Debian 7 Wheezy

  • Usare make-jpkg, che crea il pacchetto debian usando il .tar.gz scaricato dal sito Oracle

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
sudo apt-get install --t wheezy-backports java-package

Java 7 e Java 6

  • Installare la versione stock:
sudo apt-get install java-package

Creazione del pacchetto debian

  • Installare dipendenze:
 sudo apt-get install lsb-release
  • 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!