(Re)Installing Java on Slackware Linux

Author: Steven Neiland

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

Slackware comes with a java runtime environment (jre) installed but not the development kit (JDK). Also it is several versions behind the most recent release. Our goal here is to install both the JRE the Java Runtime Environment and the JDK the Java Development Kit.

Step 1:Uninstall current JRE

Run pkgtool to uninstall the jre

# pkgtool
//SELECT remove
//Select the installed jre

Step 2: Download current JDK

The JDK comes with the jre as a packwage so we dont need to worry about that seperatly. Login to KDE and open a browser. Go to oracle website OracleWebsite and download current jdk[version].bin self extracting file for linux. Place this file in /usr/local/ for now.

Step 3: Run the self extracting file

Give the binary file permission to execute and then run

# cd /usr/local
# chmod 755 jdk[version].bin
# ./jdk[version].bin

Agree to the licence and the binary will extract to the current directory. Create a symlink to this folder

# ln -s jdk[version] java

Step 4: Set environment variables

Set the JAVA_HOME environment variable, by modifying /etc/profile so it includes the following:

# vi /etc/profile
export JAVA_HOME=/usr/local/java/
export PATH=/usr/local/java/bin:$PATH

/etc/profile is run at startup and when a user logs into the system, so you will need to log out and log back in for JAVA_HOME to be defined. Check to make sure JAVA_HOME is defined correctly using the command below. You should see the path to your Java SDK as /usr/local/java

//get the java path
# echo $JAVA_HOME
//get the java version
# java -version

Step 5: Manually install firefox plugins

GOTO Firefox plugins directory and create a symbolic link to the .so file in the jre directory.

# cd /usr/lib/firefox/plugins
# ln -s /usr/local/java/jre/lib/i386/libnpjp2.so

Restart firefox and check the plugins in
You should see the java plugin listed

Reader Comments

Stacy's Gravatar
Monday, November 11, 2013 at 12:01:35 PM Coordinated Universal Time

When i run java -version i am getting command not found

Steven Neiland's Gravatar
Steven Neiland
Monday, November 11, 2013 at 12:21:10 PM Coordinated Universal Time

First try a restart to make sure that the new settings have loaded and if you are still getting command not found more than likely you have a miss configured file path. Check the file paths in the /etc/profile file match where you have put the files.

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain advertisments or appear to be created for the purpose of link building, will not be published.

Archives Blog Listing