Updating Java on Slackware 13.37 x86_64

/* Update September 2012 (pre-Slackware 14.0 only)
Check the comments on how to adapt the slackbuild to Oracle’s Java 7 */

FireFox with potentially vulnerable pluginsSo your Firefox plugin checker complains about an outdated Java plugin, and you are looking to place the blame.
Well, look no further than to the mirror to find the person to blame… yes it’s your system and it’s your responsibility to maintain it.

So what exactly is a new Slackware user supposed to do you might ask, but not for long.
If you’re unacquainted with Slackware and maintaing packages, then here is the (really) short version.

Patrick Volkerding, the founder and maintainer of the Slackware Linux distribution uses SlackBuild scripts to compile the official packages. SlackBuild scripts themselves are executable shell scripts that you run as root to configure, compile, and create Slackware packages. Using this approach, your system allows you to keep track of all packages installed.

The following example is for the 64-bit x86_64 release, for a 32-bit x86 system you will have to get the equivalent 32-bit source and java binary.

With all official packages, you have the SlackBuild scripts available with the source bundle.
Lets download the source including the SlackBuild script for Java (jre) from a Slackware mirror.

wget -r -l0 -R .bin -nH --cut-dirs=5 ftp://slackware.mirrors.tds.net/pub/slackware/slackware64-13.37/source/l/jre/

# -r -l0        Download all files and subfolders from the specified path
# -R .bin       Reject all .bin files
# -nH           Dont prefix direcories with the host
# --cut-dirs=5  Ignore all folders above /jre

This will create a new folder named jre in your current working directory.

Next, download the latest version of Java from http://java.com/en/download/manual.jsp and place it in your new jre folder.
Make sure to select the binary file and not the RPM.
For Java 6.27 (current as of writing) that equals jre-6u27-linux-x64.bin

Enter the jre folder and edit the file jre.SlackBuild modifying the lines listing the Java version from:

VERSION=6u25
DVER=1.6.0_25

to:

VERSION=6u27
DVER=1.6.0_27

Save the file and switch to the root user (su -).
Now, from within the jre folder, make the jre.SlackBuild executable with the command:

chmod +x jre.SlackBuild

Then execute the script with:

./jre.SlackBuild

Afterward, move the finished package to your jre folder for safe keeping.

mv /tmp/jre-6u27-x86_64-1.txz /your-path-here/jre/

Finally, from within the jre folder (or wherever you moved the finished package) upgrade the jre package with with the command:

upgradepkg jre-6u27-x86_64-1.txz

Your system should then report back with the message:

Package jre-6u25-x86_64-1 upgraded with new package ./jre-6u27-x86_64-1.txz.

After a restart, Firefox should now be pleased with your current Java plugin.
Firefox plugincheck up to date


2 thoughts on “Updating Java on Slackware 13.37 x86_64”

  1. What would the procedure be for Java 7? The only files available are jre-7u7-linux-x86_64.tar.gz (no .bin file). So, how would the slackbuild be changed for that?

    I’m guessing the version would be “7u7″ and would the DVER be 1.7.0_7?

    Have a great day:)
    Patrick.

    1. Hi Patrick!
      To find the version number you might use the command below (or just open the archive to see for yourself).

      tar --exclude='*/*' -tf jre-7u7-linux-x64.tar.gz

      Then adapt your slackbuild to look like this (mind the _07):
      VERSION=7u7
      DVER=1.7.0_07

      The last thing you need to do, is to replace the line that executes the old binary:

      yes yes | sh $( ls --indicator-style none $CWD/jre-${VERSION}-linux-${JAVA_ARCH}*.bin | tail -1) || exit 1

      Replace it with line below:

      tar xf $CWD/jre-${VERSION}-linux-${JAVA_ARCH}.tar.gz || exit 1

      That’s all, have a great weekend :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>