Java (Ubuntu)

Aus Tutorials
Zur Navigation springen Zur Suche springen

Akutelle Java-Version prüfen:

java -version

Oracle

Java herunterladen:

Installation

Falls folgendes Verzeichnis nicht existiert, dann dieses anlegen:

sudo mkdir /opt/Oracle_Java/
wget download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.tar.gz
tar -xzf jdk-8u92-linux-x64.tar.gz
sudo mv jdk1.8.0_92/ /opt/Oracle_Java/
sudo chown -R root:root /opt/Oracle_Java/jdk1.8.0_92/

Alternativen-System einrichten:

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/Oracle_Java/jdk1.8.0_92/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/Oracle_Java/jdk1.8.0_92/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/Oracle_Java/jdk1.8.0_92/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/jar" "jar" "/opt/Oracle_Java/jdk1.8.0_92/bin/jar" 1 

Alternativen-System konfigurieren:

sudo update-alternatives --set "java" "/opt/Oracle_Java/jdk1.8.0_92/bin/java"
sudo update-alternatives --set "javac" "/opt/Oracle_Java/jdk1.8.0_92/bin/javac"
sudo update-alternatives --set "javaws" "/opt/Oracle_Java/jdk1.8.0_92/bin/javaws"
sudo update-alternatives --set "jar" "/opt/Oracle_Java/jdk1.8.0_92/bin/jar" 

OpenJDK

OpenJDK 1.11

Installation

sudo apt-get install -y openjdk-11-jre openjdk-11-jdk openjdk-11-demo openjdk-11-doc openjdk-11-jre-headless openjdk-11-source 

VirtualBox / XUbuntu / the trustAnchors parameter must be non-empty

Edit

sudo vi /etc/java-11-openjdk/security/java.security

and replace line keystore.type = pkcs12 with keystore.type = jks.

Than call

sudo rm /etc/ssl/certs/java/cacerts file
sduo update-ca-certificates -f

OpenJDK 1.9

Installation

sudo apt-get install openjdk-9-jdk openjdk-9-demo openjdk-9-doc openjdk-9-jre openjdk-9-jre-headless openjdk-9-source 

OpenJDK 1.8

Installation

sudo apt-get install openjdk-8-jre openjdk-8-jre-headless icedtea-8-plugin openjdk-8-jdk openjdk-8-demo openjdk-8-doc openjdk-8-source 

Source

Installation:

sudo apt-get install openjdk-8-source

Speicherort:

/usr/lib/jvm/openjdk-8/src.zip

OpenJDK 1.7

Installation

Da OpenJDK 1.7 in Ubuntu 16.04 LTS nicht mehr unterstützt wird, muss eine frühere Paketquelle (in dem Fall 12.04 LTS) hinzugefügt werden:

sudo nano /etc/apt/sources.list

In /etc/apt/sources.list am Ende folgende Zeile hinzufügen:

deb http://security.ubuntu.com/ubuntu precise-security main universe

Bevor OpenJDK 1.7 installiert werden kann, müssen noch ein paar Abhängigkeiten manuell installiert werden:

wget http://launchpadlibrarian.net/159902387/libgif4_4.1.6-11_amd64.deb
sudo apt install /home/martin/Downloads/libgif4_4.1.6-11_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata_2016d-0ubuntu0.12.04_all.deb
sudo apt install /home/martin/Downloads/tzdata_2016d-0ubuntu0.12.04_all.deb
wget http://security.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata-java_2016d-0ubuntu0.12.04_all.deb
sudo apt install /home/martin/Downloads/tzdata-java_2016d-0ubuntu0.12.04_all.deb

Danach die eigentlichen Pakete installieren:

sudo apt-get install openjdk-7-jre openjdk-7-jdk openjdk-7-demo openjdk-7-doc openjdk-7-jre-headless openjdk-7-jre-lib openjdk-7-source

Deinstallation

sudo apt-get remove openjdk-7*

Links

https://wiki.ubuntuusers.de/Java/Installation/Oracle_Java/Java_8/#Java-8-JRE


Zurück zu Ubuntu