Welcome to the Slackware Documentation Project

Ceci est une ancienne révision du document !

Java et Slackware


Oracle Java

En raison des récents changement dans la licence de Oracle Java, Slackware, et toutes les autres distribution, n'ont plus l'autorisation de distribuer les binaires Java avec leur système. Cela implique de télécharger manuellement les binaires sur notre système Slackware 14.

Oracle proprose deux installeurs:

  • JRE (Java Runtime Environment) - requis pour l'exécution d'applications Java.
  • JDK (Java Development Kit) - requis pour le développement et l'exécution de programmes Java (il contient le JRE).

Comme le Java Development Kit (JDK) contient le JRE, il est recommandé d'utiliser cet installeur.

N'installez pas les deux et veillez à désinstaller les précédentes versions de Java avant de commencer l’installation d'une nouvelle version.

Java (JDK) Installation on Slackware 14 and newer

Follow the steps below to install Java on your system:

1. Visit the official download page.

2. Right under Java Platform, Standard Edition click the JDK Download and accept the license agreement.

3. Download a binary package that is appropriate for your architecture:

Linux x86 for a 32-bit version of Slackware.
Linux x64 for a 64-bit version of Slackware.

Make sure you have chosen the .tar.gz version.

At the time of writing this, the latest version (64-bit) was:


4. In a terminal log in as root:

su -

5. Go to the /extra/source/java directory on a Slackware installation DVD or change to the local directory if you downloaded it from a Slackware mirror (in which case, don't forget to download all the files and subdirectories in that “java“directory!).

6. Run the java SlackBuild specifying the path to the downloaded Java binary package.

./java.SlackBuild /path/to/jdk-7u7-linux-x64.tar.gz

Once the SlackBuild finishes, you should get a similar message:

Slackware package /tmp/jdk-7u7-x86_64-1.txz
If you get the following message, you can disregard it.
WARNING: zero length file usr/lib64/java/lib/security/trusted.libraries

7. Install the newly created package:

upgradepkg --install-new /tmp/jdk-7u7-x86_64-1.txz

8. Restart a web browser and try if Java has been detected by visiting the following website.

9. You may need to reboot the computer for the system to recognize Java:

$ which java

10. If you want slackpkg to ignore the jre and jdk packages on clean-system, add them to the blacklist in /etc/slackpkg/blacklist


If you prefer the fully Open Source alternative of OpenJDK instead of Oracle's pre-compiled and partly closed-source binaries, then you can get sources, SlackBuild scripts and/or native Slackware packages here: http://slackware.com/~alien/slackbuilds/openjdk/.

If you decide you want to use OpenJDK, the same rules apply that were written above for the Oracle Java packages: only install one of the two, either JRE or JDK! If you want a web-browser plugin like Oracle's binaries have, then install the additional icedtea-web package. Oracle kept its browser plugin closed-source. The icedtea-web package is an open-source alternative.
You will also need rhino, the JavaScript engine for OpenJDK.

If you decide you want to compile OpenJDK from source, then use the README for guidance.

Java not found after installation

Help! I installed Java but when I try to use it, I get “command not found”!

What you need to know is that the Java package installs two files in your profile directory ”/etc/profile.d/”. Depending on which login shell you use, one of these is executed whenever you login. The profile script adds the Java directory to the $PATH variable (so that you can start the java command) and sets the $JAVA_HOME variable (needed by other programs that try to locate your Java installation).

Here follows the content of such a script on 64-bit Slackware:

export JAVA_HOME=/usr/lib64/java
export MANPATH="${MANPATH}:${JAVA_HOME}/man"
export PATH="${PATH}:${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin"

This means that right after installing the Java package, you need to logout and login again in order to load the Java profile script. If it is inconvenient to logout right now, there is an alternative: you can “source” the script by running the following command in your console, or in every terminal where you want to use Java without logging out and in again (example for OpenJDK and a bash-compatible shell):

. /etc/profile.d/openjdk.sh

Note the dot character at the start of the line, that dot is the “source” command of the shell.


Autres langues
Traductions de cette page?:
QR Code
QR Code fr:howtos:software:java (generated for current page)