LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Installing Java 7 (http://www.linuxquestions.org/questions/slackware-14/installing-java-7-a-4175418118/)

Dornith 07-22-2012 03:28 PM

Installing Java 7
 
I am a Java developer who just recently switched to Slackware. One of the first things I noticed is that it's sill on Java 6. I went to the website to download the Java 7 development and run-time environment, but neither present any obvious way to install it, and I can't find anything online. How do I install Java 7?

AlleyTrotter 07-22-2012 04:47 PM

If this will meet your needs
 
AlienBobs slackbuilds has a build for openjdk

http://taper.alienbase.nl/mirrors/pe...builds/openjdk

which will build and install

java version "1.7.0_05-icedtea"
OpenJDK Runtime Environment (IcedTea7 2.2.1) (Slackware)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)

not sure if this will meet your needs but it is worth a look

john

worked first time for me.
no links pointers etc.
it just worked

55020 07-22-2012 04:57 PM

You might also want to read the blog post that went with the stuff Mr Trotter linked to: http://alien.slackbook.org/blog/upda...k-7-available/

TommyC7 07-22-2012 05:17 PM

It is also possible to use Pat's own .SlackBuild for the newer licensed proprietary Java. Just gotta download and move it to the same directory as the .SlackBuild (and other files, e.g. slack-desc), and the .SlackBuild by itself should be enough to create a package.

mats_b_tegner 07-22-2012 05:26 PM

If you want to use the Oracle binaries, download the tarball and move it to the desired location, (i.e /usr), unpack it and add the JAVA_HOME environment variable to your PATH: (i.e add the following lines to your .bash_profile)
export JAVA_HOME=/usr/jdk1.7.0_05
export PATH=$JAVA_HOME/bin:$PATH

Make a symbolic link to the JRE: (The JRE is included in the JDK)
cd /usr/lib(64)/mozilla/plugins
For a 32-bit system:
ln -s /usr/jdk1-7-0_05/jre/lib/i386/libnpjp2.so .
For a 64-bit system:
ln -s /usr/jdk1-7-0_05/jre/lib/amd64/libnpjp2.so .

Update: If you install JDK7 to your $HOME directory you can have both JDK6 and JDK7 installed on the same system.

Dornith 07-22-2012 06:33 PM

I did what Mat said, and it worked up to the symbolic link. After that it just gives em the error "File exists".

astrogeek 07-22-2012 07:12 PM

Quote:

Originally Posted by Dornith (Post 4735418)
I did what Mat said, and it worked up to the symbolic link. After that it just gives em the error "File exists".

That is probably because the file

Code:

/usr/lib(64)/mozilla/plugins/libnpjp2.so
...(or another symbolic link of that name) already exists, being leftover from the original jre/jdk package.

You should be able to simply remove it and create the new one in its place. (In fact, it may already point to the right place!)

If you instead use the original slackbuild script to build a new package using java 7 then it will take care of the symlinks, and other housekeeping chores, for you.

Dornith 07-22-2012 09:28 PM

Okay, I got everything set up, but now when I do a plug-in test with firefox, it still says my Java is out of date. Also, when I try to run the Java program from the menu, it never opens up (at least the GUI doesn't) so I can't check to see if it's updated there. And when I try to check from console, I get this: "java: relocation error: java: symbol JLI_Launch, version SUNWprivate_1.1 not defined in file libjli.so with link time reference".

astrogeek 07-23-2012 01:18 AM

Quote:

Originally Posted by Dornith (Post 4735493)
Okay, I got everything set up, but now when I do a plug-in test with firefox, it still says my Java is out of date. Also, when I try to run the Java program from the menu, it never opens up (at least the GUI doesn't) so I can't check to see if it's updated there. And when I try to check from console, I get this: "java: relocation error: java: symbol JLI_Launch, version SUNWprivate_1.1 not defined in file libjli.so with link time reference".

I do not have a 64 bit system here, so I was waiting for someone better to reply, but if not, here are my thoughts:

First, following Mat's instructions is maybe OK on a system that does not already have java installed, but unpacking the archive directly into the /usr directory is not really something that you should normally do anyway.

Because the symlink or file already existed you probably did not first remove the existing java package. So you probably now have a mixed bag of java on your system.

At the very least I would tell you to remove and reinstall the original java package (java 6). I always use removepkg and installpkg, but you could the same with pkgtool (or sbopkg?). But the idea is, restore your system to a known good state with java 6.

Then as TommyC7 and I indicated earlier, try to use Pat's original Slackbuild to build the java 7 package from the tarball. These should require only a version edit in the Slackbuild script. Place the slackbuild script (plus slack-desc, profile.d, other files from source tree) and java 7 tarball in the same directory and build.

Slackware 13.37 jre.Slackbuild here ftp://ftp.slackware.com/pub/slackwar...jre.SlackBuild

Slackware 13.37 jdk.Slackbuild here ftp://ftp.slackware.com/pub/slackwar...jdk.SlackBuild

If it builds OK, simply removepkg jre (or jdk), then installpkg path-to-new-package.tgz.

The package will then take care of basic environment variables and symlinks, and keep your system clean (and your package DB in sync).

If you hit any snags, perhaps someone with a 64 bit box can chime in here - but it should be pretty simple.

[EDIT]
On reviewing the posts here it is not clear at all that this is for a 64 bit machine, sorry.
But in either case the advice to clean up by removing/reinstalling java 6, then building java 7 package using the same slackbuild script should work fine. Be sure to read the pages linked on Eric's blog above as well.
[/EDIT]

mats_b_tegner 07-23-2012 04:01 AM

The jdk-6 SlackBuild-script from 13.37 won't work unmodified since it looks for a .bin package and JDK 7 is shipped as tar.gz package.

Update:
You'll need to patch the SlackBuild-script to make it work with JDK7:
https://www.linuxquestions.org/quest...dk-jre-931082/

Dornith 07-23-2012 05:07 PM

Firstly, I would like to thank you all so much. I've spent days working on this and now it's all working perfectly.

I uninstalled Java completely as Astrogeek suggested and downloaded the SlackBuild too. (Although you gave me the 32bit links, which took me a while to figure out) I manually applied the patches that Mat linked to and now it's all working. The Java GUI runs and shows Java7 installed, and Firefox says I'm up-to-date. Thank all so much for helping me.


Also, I did create most of my problems myself by working with packages when I didn't really understand them at all.

astrogeek 07-23-2012 06:18 PM

Glad to hear it is all working!

Sorry I was not more clear about the 32/64 Slackbuld, I wrote that all on the fly.

Working with Slackbuilds to create your own packages is really easy and well worth the trouble to understand fully - it is how Slackware is put together!

The power of the package is of course, you can easily update to a new version without breakage and you can distribute and archive your own pacakges across your own systems.

When updating an official Slackware package you can almost always adapt the Slackbuild from the distribution source directories. For apps that are not natively part of Slackware you can usually find build script at Slackbuilds.org, or create one from a similar script.

FWIW - If you have disk space it is always a good idea to keep an archive of the build scripts and sources that you have updated. When java 7_06 is released simply edit the version in the script and build the new package. Then removepkg jre/jdk, installpkg path_to_new... makes updating trivial (usually).

Good luck!

mats_b_tegner 07-30-2012 06:57 PM

FYI There is an updated JDK7/JRE7 SlackBuild-script in -current/extra/source according to the latest ChangeLog.

zerouno 07-31-2012 05:47 AM

Quote:

Originally Posted by mats_b_tegner (Post 4741707)
FYI There is an updated JDK7/JRE7 SlackBuild-script in -current/extra/source according to the latest ChangeLog.

jre and jdk packaged with Pat slackbuilds:
http://www.z01.eu/repo-slack/slackwa...t/development/

T3slider 07-31-2012 06:02 PM

You really should take those packages down...the reason they are not being shipped with Slackware is because Oracle has removed binary redistribution rights so by hosting binary packages you are likely violating the law (or at least inviting a cease and desist from Oracle). Since the SlackBuilds just repackage the official binaries it should be easy for anyone to run it and thus hosting packages is not overly necessary anyway.


All times are GMT -5. The time now is 12:14 PM.