LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 02-24-2012, 11:41 AM   #1
l0rddarkf0rce
Member
 
Registered: Nov 2004
Posts: 83

Rep: Reputation: 18
Latest Oracle Java JDK/JRE


Has anyone built a package for 13.37 with the latest version of Oracle Java (6 Update 31)? I read a thread where AlienBob built an OpenJAVA package, but unfortunately I cannot use OpenJAVA. I've found a couple of places (work related) that do not work at all using OpenJAVA, therefore the reason for askign for Oracle Java. Any help will be appreciated.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-24-2012, 11:53 AM   #2
mats_b_tegner
Member
 
Registered: Nov 2009
Location: Gothenburg, Sweden
Distribution: Slackware64
Posts: 141

Rep: Reputation: 47
You'll need the contents from the jdk/jre source directory (i.e jre.SlackBuild, slack-desc, etc) from your favorite Slackware mirror and the jdk/jre .bin file from Oracle. Then run upgradepkg on the newly created package in /tmp.

Last edited by mats_b_tegner; 02-24-2012 at 11:57 AM.
 
Old 06-03-2012, 02:37 PM   #3
wadsworth
Member
 
Registered: Aug 2007
Distribution: Slackware64 13.37
Posts: 214

Rep: Reputation: 64
The latest java download (7u4) is a ".tar.gz" instead of a ".bin".

How can the official SlackBuild be modified to handle this?
 
Old 06-03-2012, 03:10 PM   #4
cwizardone
Senior Member
 
Registered: Feb 2007
Distribution: Slackware64-current & "True Multilib." PC-BSD.
Posts: 2,233

Rep: Reputation: 176Reputation: 176
Edit it accordingly and change,

yes yes | sh $CWD/jdk-${VERSION}-linux-${JAVA_ARCH}.bin || exit 1

to

yes yes | sh $CWD/jdk-${VERSION}-linux-${JAVA_ARCH}.tar.gz || exit 1
 
2 members found this post helpful.
Old 06-03-2012, 06:36 PM   #5
wadsworth
Member
 
Registered: Aug 2007
Distribution: Slackware64 13.37
Posts: 214

Rep: Reputation: 64
Made these changes to the SlackBuild and it looks like its working.
Code:
-VERSION=6u27
+VERSION=7u4

-DVER=1.6.0_27
+DVER=1.7.0_04

-yes yes | sh $( ls --indicator-style none $CWD/jre-${VERSION}-linux-${JAVA_ARCH}*.bin | tail -1) || exit 1
+tar xf $CWD/jre-${VERSION}-linux-${JAVA_ARCH}*.tar.gz
(only tested on 64-bit)

Had some trouble with "Minecraft" though, now need to start with:
LD_LIBRARY_PATH="/usr/lib64/java/lib/amd64" java -jar minecraft.jar
 
2 members found this post helpful.
Old 06-04-2012, 04:44 AM   #6
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,817

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
Quote:
Originally Posted by cwizardone View Post
Edit it accordingly and change,

yes yes | sh $CWD/jdk-${VERSION}-linux-${JAVA_ARCH}.bin || exit 1

to

yes yes | sh $CWD/jdk-${VERSION}-linux-${JAVA_ARCH}.tar.gz || exit 1
That won't work. The extension didn't just change. They are actually different types of files. The old one is self extracting. The new one is not.

@l0rddarkf0rce: I would do it like this.

If Slackware, then:

Code:
$ wget -r -np -nH -Rbin --cut-dirs=5 ftp://ftp.osuosl.org/pub/slackware/slackware-13.37/source/l/jre/
$ cd jre/
$ wget 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=63202' -O jre-7u4-linux-i586.tar.gz
If Slackware64, then:

Code:
$ wget -r -np -nH -Rbin --cut-dirs=5 ftp://ftp.osuosl.org/pub/slackware/slackware64-13.37/source/l/jre/
$ cd jre/
$ wget 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=63204' -O jre-7u4-linux-x64.tar.gz
Now you can create a patch for the SlackBuild to upgrade the version number(s), "source" package and add man pages (that was missing for the original SlackBuild):

Code:
$ cat << PATCHEND > jre.SlackBuild.patch
--- jre.SlackBuild.orig
+++ jre.SlackBuild
@@ -23,8 +23,8 @@
 
 # Note that the slack-desc file mentions the JRE version (edit when upgrading)!
 
-VERSION=6u25
-DVER=1.6.0_25
+VERSION=7u4
+DVER=1.7.0_04
 ARCH=i586
 BUILD=\${BUILD:-1}
 
@@ -57,7 +57,7 @@
 cd \$PKG
 mkdir -p usr/lib\${LIBDIRSUFFIX}
 cd usr/lib\${LIBDIRSUFFIX}
-yes yes | sh \$( ls --indicator-style none \$CWD/jre-\${VERSION}-linux-\${JAVA_ARCH}*.bin | tail -1) || exit 1
+tar xf \$CWD/jre-\${VERSION}-linux-\${JAVA_ARCH}.tar.gz || exit 1
 mkdir -p \$PKG/etc/profile.d
 for file in \$(ls \$CWD/profile.d/*) ; do
   cat \$file | sed -e "s#lib/java#lib\${LIBDIRSUFFIX}/java#" \\
@@ -84,6 +84,13 @@
   ln -sf ./java/lib/\${LIB_ARCH}/server/libjvm.so .
 )
 
+# Move and compress any man pages
+if [ -d "\$PKG/usr/lib\${LIBDIRSUFFIX}/java/man" ]; then
+  mv \$PKG/usr/lib\${LIBDIRSUFFIX}/java/man \$PKG/usr
+  find \$PKG/usr/man -type f -exec gzip -9 {} \;
+  for i in \$( find \$PKG/usr/man -type l ) ; do ln -s \$( readlink \$i ).gz \$i.gz ; rm \$i ; done
+fi
+
 mkdir -p \$PKG/install
 cat \$CWD/slack-desc > \$PKG/install/slack-desc
 
PATCHEND
Now apply this patch.

If Slackware, then:

Code:
$ patch < jre.SlackBuild.patch
If Slackware64, then:

Code:
$ sed -i 's/^\( ARCH=\)i586/\1x86_64/' jre.SlackBuild.patch
$ patch < jre.SlackBuild.patch
Finally make jre.SlackBuild executable, run and install it:

Code:
$ chmod +x jre.SlackBuild
$ su
# ./jre.SlackBuild
# upgradepkg /tmp/jre-7u4-*-1.txz
If you haven't done so already you may want to add jre to the slackpkg blacklist (so that it doesn't get downgraded):
Code:
# slackpkg blacklist jre

Last edited by ruario; 06-04-2012 at 10:46 AM. Reason: s/wadsworth/l0rddarkf0rce/
 
6 members found this post helpful.
Old 06-04-2012, 04:55 AM   #7
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,817

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
@wadsworth: Ah, I see you worked this out already.

Oh well, I have to update mine anyway and perhaps those steps will be useful to someone else who stumbles onto this thread.
 
Old 06-18-2012, 08:29 AM   #8
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,817

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
I see that Oracle Java updated to 1.7.0_05 and I've realised that manually patching jre.SlackBuild again and again for every update is boring. So I wrote a short shell script to do it. Nothing fancy but I figured I'd post it here nonetheless as others must also be encountering this issue. Save the code below into an appropriately named file (e.g. updatejreslackbuild.sh) in the same directory as jre.SlackBuild (or an empty directory, as it will fetch jre.SlackBuild and associated files). Then run it and it will update jre.SlackBuild for the latest available version (along with downloading the binary package from Oracle).

Code:
#!/bin/sh

ARCH=${ARCH:-$(uname -m)}

case "$ARCH" in
  i?86) ARCH=i586 ;;
     *) ARCH=$ARCH ;;
esac

if [ "$ARCH" = "i586" ]; then
  JAVA_ARCH=i586
  PKGURL=$(wget -qO- http://java.com/en/download/manual.jsp | grep 'Download Java software for Linux"' | head -n1 | sed -rn 's@.*href="(http.*BundleId=[0-9]+)" .*@\1@p')
elif [ "$ARCH" = "x86_64" ]; then
  JAVA_ARCH=x64
  PKGURL=$(wget -qO- http://java.com/en/download/manual.jsp | grep 'Download Java software for Linux x64"' | head -n1 | sed -rn 's@.*href="(http.*BundleId=[0-9]+)" .*@\1@p')
else
  echo "The architecture $ARCH is not provided as a binary Java (jre) package; exiting"
  exit 1
fi

if [ -z "$PKGURL" ]; then
  echo "Could not work out the download link for the latest Java (jre) package; exiting"
  exit 1
fi

SOURCE=$(wget --spider "$PKGURL" 2>&1 | grep '^Location' | sed -rn 's@.*File=(jre-.*\.tar.gz)&.*@\1@p')

if [ -z "$SOURCE" ]; then
  echo "Could not work out the name for the binary package; exiting"
  exit 1
fi

if [ ! -e "$SOURCE" ]; then
  echo "Fetching $SOURCE"
  if ! wget "$PKGURL" -O "$SOURCE"; then
    echo "There were problems downloading $SOURCE"
    exit 1
  fi
fi

VERSION=$(/bin/ls -tr jre-*-linux-$JAVA_ARCH.tar.gz | tail -n1 | cut -d- -f2)

if [ -z "$VERSION" ]; then
  echo "Could not work out the short jre version number; exiting"
  exit 1
fi

DVER=$(tar tf jre-$VERSION-linux-$JAVA_ARCH.tar.gz | head -n 1 | sed -r 's@jre([0-9_\.]+)/.*@\1@')

if [ -z "$DVER" ]; then
  echo "Could not work out the long jre version number; exiting"
  exit 1
fi

if [ ! -e jre.SlackBuild ]; then
  echo "Fetching jre.SlackBuild"
  if ! wget -r -np -nH -Rbin --cut-dirs=6 ftp://ftp.osuosl.org/pub/slackware/slackware-13.37/source/l/jre/; then
    echo "There were problems fetching the original jre.SlackBuild (and associated files) from:"
    echo "ftp://ftp.osuosl.org/pub/slackware/slackware-13.37/source/l/jre/"
    exit 1
  fi
  chmod +x jre.SlackBuild
fi

sed -i.previous "s/^VERSION=.*/VERSION=$VERSION/;s/^DVER=.*/DVER=$DVER/;s/^ARCH=.*/ARCH=$ARCH/;s/JAVA_ARCH:-i586/JAVA_ARCH:-$JAVA_ARCH/;s@^yes yes.*@tar xf \$CWD/jre-\$\{VERSION\}-linux-\$\{JAVA_ARCH\}.tar.gz || exit 1@" jre.SlackBuild

if [ "$?" = "0" ]; then
  chmod -x jre.SlackBuild.previous
  echo "jre.SlackBuild has been updated to build Oracle Java version $VERSION ($DVER) for $ARCH"
fi
 
4 members found this post helpful.
Old 06-18-2012, 10:41 AM   #9
aocab
Member
 
Registered: Nov 2009
Location: Heart of Texas
Distribution: Slackware-current
Posts: 138

Rep: Reputation: 30
Quote:
Originally Posted by ruario View Post
I see that Oracle Java updated to 1.7.0_05 and I've realised that manually patching jre.SlackBuild again and again for every update is boring. So I wrote a short shell script to do it. Nothing fancy but I figured I'd post it here nonetheless as others must also be encountering this issue. Save the code below into an appropriately named file (e.g. updatejreslackbuild.sh) in the same directory as jre.SlackBuild (or an empty directory, as it will fetch jre.SlackBuild and associated files). Then run it and it will update jre.SlackBuild for the latest available version (along with downloading the binary package from Oracle).
Tested here:

I placed the file in a folder named "New Folder" and it would not run.
Changed the folder name to "New_Folder" and it ran.

The resulting slackbuild built the package okay but at the end I got this warning
(not sure why - so I did not install):
WARNING: zero length file usr/lib/java/lib/security/trusted.libraries

Last edited by aocab; 06-18-2012 at 11:33 AM.
 
1 members found this post helpful.
Old 06-18-2012, 12:51 PM   #10
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,817

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
I wouldn't worry, it is a zero byte file in the original 'source' package and the rpm that Oracle provide as well:

Code:
$ tar tvf jre-7u5-linux-i586.tar.gz jre1.7.0_05/lib/security/trusted.libraries
-rw-r--r-- java_re/java_re   0 2012-05-15 20:29 jre1.7.0_05/lib/security/trusted.libraries
Code:
$ tail -c 21230693 jre-7u5-linux-i586.rpm | zcat | cpio -tv ./usr/java/jre1.7.0_05/lib/security/trusted.libraries
-rw-r--r--   1 root     root            0 May 15 20:29 ./usr/java/jre1.7.0_05/lib/security/trusted.libraries
97378 blocks
 
Old 06-18-2012, 01:02 PM   #11
aocab
Member
 
Registered: Nov 2009
Location: Heart of Texas
Distribution: Slackware-current
Posts: 138

Rep: Reputation: 30
Quote:
Originally Posted by ruario View Post
I wouldn't worry, it is a zero byte file in the original 'source' package and the rpm that Oracle provide as well:
Thanks...
I was just getting ready to edit my post and say never mind
I noticed the zero byte file in the original.
Cheers
 
Old 06-19-2012, 12:33 AM   #12
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,817

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
Quote:
Originally Posted by aocab View Post
I placed the file in a folder named "New Folder" and it would not run.
Changed the folder name to "New_Folder" and it ran.
My script should run just fine in a directory with a space in the name, however jre.SlackBuild will not as it is missing appropriate quoting in some places. This is actually the case with quite a few SlackBuild scripts, so I would generally avoid spacing in directory names anyway.

Last edited by ruario; 06-19-2012 at 02:04 AM. Reason: Added the word 'avoid' so that my final sentance makes sense! ;)
 
Old 06-19-2012, 01:03 AM   #13
aocab
Member
 
Registered: Nov 2009
Location: Heart of Texas
Distribution: Slackware-current
Posts: 138

Rep: Reputation: 30
Quote:
Originally Posted by ruario View Post
My script should run just fine in a directory with a space in the name, however jre.SlackBuild will not as it is missing appropriate quoting in some places. This is actually the case with quite a few SlackBuild scripts, so I would generally spacing in directory names anyway.
Correct. My bad. After I wrote my original post...I read it again and noticed it was written as if your script was the issue.
So I went back and edited the post to make it clear that the issue was with the slackbuild script but I forgot to edit both parts. Sorry.
 
Old 06-19-2012, 05:22 AM   #14
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,234

Rep: Reputation: Disabled
Quote:
Originally Posted by ruario View Post
My script should run just fine in a directory with a space in the name, however jre.SlackBuild will not as it is missing appropriate quoting in some places. This is actually the case with quite a few SlackBuild scripts, so I would generally avoid spacing in directory names anyway.
Using spaces in directory names is not supported by Slackware's scripts. I also do not support it in any of my own scripts. I even have a script (massconvert32.sh) which aborts when it detects a space in the directory name.

Spaces in directory names is an abomination introduced by MS Windows and lazy-ass GUI programs. Real UNIX men avoid space.

Eric
 
3 members found this post helpful.
Old 06-19-2012, 05:48 AM   #15
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,817

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
Quote:
Originally Posted by Alien Bob View Post
Spaces in directory names is an abomination introduced by MS Windows and lazy-ass GUI programs. Real UNIX men avoid space.
Good stuff Eric! You just created my new favourite quote.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java JRE and JDK on CentOs nuttynibbles Linux - Software 1 06-11-2011 01:41 AM
How to install Java jdk and jre in linux BuhRock Linux - Newbie 2 03-27-2011 04:28 PM
[SOLVED] Java Woes: A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available ... chytraeus Slackware 10 11-27-2010 10:04 AM
Please help me install latest JDK & JRE on my CentOS server xNuManx Linux - General 5 10-04-2008 04:49 AM


All times are GMT -5. The time now is 01:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration