[2024-jan-12] The Wiki has been upgraded and its template changed from MonoBook to Vector for a more modern look and feel.

Welcome to the Slackware Documentation Project

Java in Slackware

Oracle Java

Due to recent changes in Oracle's Java licensing, Slackware, or any other distribution, is no longer allowed to distribute Java binary packages with the operating system. What it means for us is that although we will still be able to install Java on our system, as of Slackware 14 we will be required to manually download the binary package.

Oracle offers two packages:

  • JRE (Java Runtime Environment) - required to run Java applications.
  • JDK (Java Development Kit) - required to develop and run Java applications (it includes the JRE).

As the JRE is included in the JDK, the Java Development Kit (JDK) is a recommended package to install.

Please do NOT install both packages and make sure you remove any previously installed Java packages before you start the installation

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.


 howtos:software:java ()