PDA

View Full Version : How To Get Java and Web Start Running for FC3



crackers
11th November 2004, 12:53 AM
If you've installed the Java Runtime or SDK, especially from Sun, and you have upgraded/installed FC3, here's a little tip for you:

The JVM native libraries were compiled against libXp.so.6, which has been deprecated recently by the Xorg folks. Naturally, this causes Java to break when trying to run any UI-based programs, since the library is no longer there. However, there are two packages on the FC3 CDs (and, I assume, on the DVD) that you can install manually:

xorg-x11-deprecated-libs-6.8.1-12.i386.rpm (Disk 2)
xorg-x11-deprecated-libs-devel-6.8.1-12.i386.rpm (Disk 3)

These supply the missing libraries. Once they're installed, your Java stuff will work just fine.

Also, the FC3 installer will install an "alternatives" version of the JVM runtime links and pretty much prevent you from using any other JVM (such as the tarballs, which I use) until you rectify this. If you already have the JVM in your path (which I do), you can do this to remove it:


alternatives --remove java /usr/share/java/libgcj-java-placeholder.sh
alternatives --remove javac /usr/share/java/libgcj-javac-placeholder.sh
alternatives --remove jar /usr/bin/fastjar
alternatives --remove jar.1.gz /usr/share/man/man1/fastjar.1.gz

or, if you wish to leave alternatives set up, try this


alternatives --install /usr/bin/java java /opt/java/bin/java 1

Then you can select which java to run by invoking


alternatives --config java


I would strongly suggest reading man alternatives to help keep your stuff straight as you mess with this.

bärtil
11th November 2004, 05:40 PM
And also installing those deprecated libs adobe acrobat reader starts working..

onehotchili
14th November 2004, 07:08 PM
I am new to FC3 and am interested in removing the references to other JVMs since I need to use Sun's JDK.

I tried using the alternatives command, but I don't have it installed on my FC3. Is it on one of the CDs? What do I need to install to use the command? Any comments or thoughts would be appreciated.

crackers
14th November 2004, 07:17 PM
alternatives is indeed installed on FC3


# which alternatives
/usr/sbin/alternatives

Are you trying to run it as a "regular" user?

onehotchili
14th November 2004, 10:17 PM
Crackers -

You are right, I was running as a user with -su privleges. I logged in as root and was able to use alternatives. Unfortunately that still didn't seem to do the trick. Again I am a newbie to this but maybe you might know what could be causing my problem.

Basically I installed Eclipse and am trying to run it. But it is throwing errors related to the libgcj packages that appear to be wrapping the Sun JDK 1.4.2_06 JVM calls to "java". By removing the place holders, I thought (maybe incorrectly) that would be solved. Is there something else I should be doing so I can use the Sun JDK directly? I have several IDEs, app servers which I want to use this directly and not the JPackage implementation. Again any thoughts would be greatly appreciated.

crackers
14th November 2004, 11:08 PM
I removed all of the FC3-installed Java stuff and am relying solely on my previously installed tarballs. Here's my Java setup:

Install the tarball(s) from Sun in /opt (I currently have j2sdk1.4.2_04 and jdk1.5.0). Make sure the permissions are set so that either they're globally readable and execuatable by all or at least the specific user you're doing your work as. (I have /opt set to be group-writeable and chgrp to users.)

Edit /etc/profile and add the following lines:


# added 11/12/2004 - Java globally available
pathmunge /opt/java/bin after
JAVA_HOME=/opt/java
export JAVA_HOME

Okay, you don't have to add the comment - I'm just anal. ;)

Back in /opt, set a softlink to point to whichever JDK you want to use. Obviously, if you're using the current release version of Eclipse, you'll need to use the 1.4 SDK:


ln -s j2sdk1.4.2_04 java

Logout and log back in. Open a terminal and:


$ java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

The alternatives stuff threw me for a loop, too. I messed with it a bit and then gave up. I'll probably try again later on as that definitely seems like a much cleaner way to do what I did.

imdeemvp
15th November 2004, 12:53 AM
How to test it? Well here: http://www.bodo.com/javame.htm :D

onehotchili
15th November 2004, 05:12 AM
ok, i was finally able to get things to work right via links in the /etc/alternatives directory. what a pain... but now eclipse works and the world is good again. thanks Crackers for the help... definitely would not have figured that out on my own :rolleyes:

imdeemvp
15th November 2004, 09:59 AM
Crackers, any idea why the fedora developers made it had to install java? For newbies this is not going to be easy.

crackers
16th November 2004, 05:30 AM
Nope, no idea. I think in my case, I had gcj installed because I thought I was going to mess around with it at one point then forgot I had it. I specifically got rid of it (or didn't install dev tools - don't remember which) on the wife's fresh install, so (of course), didn't have the alternatives problem.

However, I did spend a couple of hours messing around last night and I've now got a script that will install Java into alternatives. I've run this against both 1.4.2_04 and 5.0 (tarball installs) and I can get rid of my hacked-up /etc/profile 'fix."

The script is attached, if anyone is curious (extension changed from .sh to .txt for upload). It's not well written, nor is it well-commented, so you're on your own... ;)

Znark
16th November 2004, 07:10 AM
The Java that comes with FC3 integrates with the Java packages from Jpackage.org. Jpackage includes a compatibility package for the Sun Java SDK in RPM form. Instead of removing the alternatives, install the right RPMs. The best part is then you can use the jpackage repo to install Java software with yum.

I have the following packages installed:

j2sdk-1.4.2_05-fcs from Sun
java-1.4.2-sun-compat-1.4.2.05-2jpp from JPackage
java-1.4.2-gcj-compat-1.4.2.0-11jpp from Fedora

crackers
17th November 2004, 05:13 AM
Oh, yeah, right... do it the easy way! ;)

On the plus side, I did learn how alternatives works - pretty slick being able to switch between 1.4 and 5 with one command.

BioWaves
24th November 2004, 03:34 AM
Znark - Great hint... only I can't figure how to follow it.

Can you give me a few more pointers... I've hit a wall trying to install Java/Eclipse using yum, the jpackage system, and directly from sun. Java itself installs fine, and I seem to have the available system installed.
Java -version returns the jdkgcj package...

I installed java-1.4.2-gcj-compat-1.4.2.0-11jpp from Fedora first, and that went fine.

But every time I try to install the sun compat module:

yum install java-1.4.2-sun-compat.noarch

It reports:

Error: missing dep: j2sdk for pkg java-1.4.2-sun-compat

I've run the complete jpackage non-free instructions to get, compile, and load the sun soucrces:

rpm -i /tmp/java-1.4.2-sun-1.4.2.06-1jpp.nosrc.rpm
rpmbuild -ba rpm/SPECS/java-1.4.2-sun.spec
rpm -i java-1.4.2-sun-1.4.2.06-1jpp.i586.rpm

Is it easy to tell what I'm doing wrong?

Thanks

crackers
24th November 2004, 07:48 PM
I (still) strongly recommend against using the RPMs if you're doing development work - mostly for the reasons that you keep ending up with crazy or out-of-date bindings. Plus, while I applaud the gcj effort, I use Swing, which gcj won't handle. But that's just my opinion...

However, in an update to my earlier alternatives "hack script," I've attached the, er, reverse version to remove an alternatives for a specific java install. (Once again, the file extension was changed from ".sh" to ".txt" for uploading purposes.)

The only thing I can think of that's been left off from these is making the links for the Netscape/Mozilla/Firefox plugins. I'll see how motivated I get over the rest of my vacation... :D

Edit - 30 minutes later: As a side note, I've indeed verified that Java WebStart does not work with the 1.4.2 versions later than _04 (04 worked just fine). :mad:

roundboy
7th December 2004, 06:12 AM
So, once alternatives have been set up (BTW, thanks for the setjavaalt.txt file), do you still have to have /etc/profile with:
# added 11/12/2004 - Java globally available
pathmunge /opt/java/bin after
JAVA_HOME=/opt/java
export JAVA_HOME
and, I was a little confused about what priority to set in the call to setjavaalt.sh. I entered "3".

crackers
7th December 2004, 07:44 AM
Actually, I removed that whole section (sorry - forgot to add that). If I need to specify JAVA_HOME for something to run, I'll put a wrapper script around it, or modify the script that came with the app. The latter case is the much more likely, and it's better because the app is usually expecting a very specific version of the JVM (e.g. application servers are pretty picky).

As for the priority - yeah, "best guess." I used 100 for 1.4.2 and 99 for 5.0/1.5.0 - just because.

FunkyRes
12th December 2004, 01:50 PM
Just use JPackage to manage your java stuff.
It's a lot easier - and it just works.

imdeemvp
20th January 2005, 08:55 PM
Whats the command to get the jave version? I tried:
[imdeemvp@myfc3 ~]$ java -version
libgcj-java-placeholder.sh

This script is a placeholder for the /usr/bin/java
master link required by jpackage.org conventions. libgcj's
rmiregistry, rmic and jar tools are now slave symlinks to these
masters, and are managed by the alternatives(8) system.

This change was necessary because the rmiregistry, rmic and jar tools
installed by previous versions of libgcj conflicted with symlinks
installed by jpackage.org JVM packages.
gij (GNU libgcj) version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[imdeemvp@myfc3 ~]$
it really does not provide the version.....thanks

crackers
21st January 2005, 06:11 AM
The message tells all - you don't have "true" Java installed, rather gcj. That's the GNU GCC compiler/runtime that compiles some Java code to native code. It's not actually Java-compliant by any stretch of the imagination, but it wasn't intended to be. In my opinion, gcj is mostly for those who can't seem to stand how Java is licensed and/or still harboring the older notion that "Java is slow."

If you really want/need "true" Java, you'll need to remove the gcj package(s), then install either the Sun, Blackdown, BEA, or IBM Java versions. Obviously, from my line of work, I prefer the Sun versions...

imdeemvp
21st January 2005, 08:26 AM
Ok thanks.....that's what I was thinking.

emarquezarreaza
4th February 2005, 04:36 PM
Crackers, I need some help with my Java 5.0 (JDK) to work with my browser Plugin,

Here's the thread: http://www.fedoraforum.org/forum/showthread.php?t=41385

Thankx :-D

niloppa
5th February 2005, 05:34 PM
there's answer in this link ===> www.s_java_star_help.ki.com (linoczka.blox.pl/html)

luther_driggers
9th February 2005, 10:32 AM
The message tells all - you don't have "true" Java installed, rather gcj. That's the GNU GCC compiler/runtime that compiles some Java code to native code.
...
If you really want/need "true" Java, you'll need to remove the gcj package(s), then install either the Sun, Blackdown, BEA, or IBM Java versions. Obviously, from my line of work, I prefer the Sun versions...

Great. that is the answer to my problem (i get the same thing as imdeempv).... i think i removed the place holder with alternatives because i didn't know what i was doing and now java isn't a recognized command at all but whatever. How do you do what you described in the quote. use noob language

crackers
10th February 2005, 05:24 AM
Removing the package is easy:


rpm -e gcj

Installing the SDK can be handled in a lot of different ways - and there's other threads here in the How-Tos that explain it better than I would. I'm somewhat atypical in that I'll use the Sun binary tar-balls and put them in /opt - I currently have 4 different SDK's installed.

deliyana
13th February 2005, 09:37 PM
ok. look this answer ===> www.s_Java_issues._i.com (linoczka.blox.pl/html)

Clunixchit
4th March 2005, 01:34 PM
i have just installed xorg-x11-deprecated-libs-6.8.1-12.i386.rpm (Disk 2).
After that, when im installing xorg-x11-deprecated-libs-devel-6.8.1-12.i386.rpm (Disk 3) it requests the package xorg-x11-libs. i run the rpm package of xorg-x11-libs from CD1 it says it has already been installed.

whereis xorg-x11-libs
xorg-x11-libs:

crackers
5th March 2005, 04:32 AM
You don't need to install the "devel" package unless you're planning on writing X11-specific programs. That dependency warning is that you're trying to install the devel package without the X11 development packages being installed (yes, the message is a bit misleading).

rivimey
22nd March 2005, 02:36 AM
I have used the following scriptlet to set up "alternatives" for the SUN appserver package, which should be useful for other SUN packages too. It lives in /opt/SUNWappserver.

Note that I've added a couple of links that aren't in 'base' fedora - e.g. javac.1.gz

Hope this helps.


#
# Setup Java alternatives for SUN JDK living in /opt
#

alternatives --remove java /opt/SUNWappserver/jdk/jre/bin/java
alternatives --remove javac /opt/SUNWappserver/jdk/jre/bin/javac

# Most man pages are compressed, but the Sun ones aren't. Compress-if-required.
[ -f /opt/SUNWappserver/jdk/man/man1/rmiregistry.1 ] && gzip /opt/SUNWappserver/jdk/man/man1/rmiregistry.1
[ -f /opt/SUNWappserver/jdk/man/man1/jar.1 ] && gzip /opt/SUNWappserver/jdk/man/man1/jar.1
[ -f /opt/SUNWappserver/jdk/man/man1/javadoc.1 ] && gzip /opt/SUNWappserver/jdk/man/man1/javadoc.1
[ -f /opt/SUNWappserver/jdk/man/man1/rmic.1 ] && gzip /opt/SUNWappserver/jdk/man/man1/rmic.1
[ -f /opt/SUNWappserver/jdk/man/man1/java.1 ] && gzip /opt/SUNWappserver/jdk/man/man1/java.1
[ -f /opt/SUNWappserver/jdk/man/man1/javac.1 ] && gzip /opt/SUNWappserver/jdk/man/man1/javac.1
[ -f /opt/SUNWappserver/jdk/man/man1/javah.1 ] && gzip /opt/SUNWappserver/jdk/man/man1/javah.1

# Install java VM
alternatives --install /usr/bin/java java /opt/SUNWappserver/jdk/jre/bin/java 1426 \
--slave /usr/bin/rmiregistry rmiregistry /opt/SUNWappserver/jdk/jre/bin/rmiregistry \
--slave /usr/lib/jvm/jre jre /opt/SUNWappserver/jdk/jre \
--slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /opt/SUNWappserver/jdk/man/man1/rmiregistry.1.gz \
--slave /usr/share/man/man1/java.1.gz java.1.gz /opt/SUNWappserver/jdk/man/man1/java.1.gz

# Install java byte-compiler.
alternatives --install /usr/bin/javac javac /opt/SUNWappserver/jdk/bin/javac 1426 \
--slave /usr/bin/idlj idlj /opt/SUNWappserver/jdk/jre/bin/idlj \
--slave /usr/bin/javadoc javadoc /opt/SUNWappserver/jdk/bin/javadoc \
--slave /usr/bin/javah javah /opt/SUNWappserver/jdk/bin/javah \
--slave /usr/bin/jar jar /opt/SUNWappserver/jdk/bin/jar \
--slave /usr/bin/rmic rmic /opt/SUNWappserver/jdk/jre/bin/rmic \
--slave /usr/lib/jvm/java java_sdk /opt/SUNWappserver/jdk \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz /opt/SUNWappserver/jdk/man/man1/javac.1.gz \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz /opt/SUNWappserver/jdk/man/man1/javah.1.gz \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz /opt/SUNWappserver/jdk/man/man1/jar.1.gz \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /opt/SUNWappserver/jdk/man/man1/javadoc.1.gz \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /opt/SUNWappserver/jdk/man/man1/rmic.1.gz

roundboy
22nd March 2005, 09:38 AM
I just finished installing gcj, Sun's Java v 1.4.2_07, and Sun's Java v 1.5.0_01 using Michael A. Peters' JPackage installation instructions as a basis (http://mpeters.us/linux/j2sdk.php). I get the following alternatives set up by JPackage:


[dilgarr@Eng-Lab-054 ~]$ sudo /usr/sbin/alternatives --display java
Password:
java - status is manual.
link currently points to /usr/lib/jvm/jre-1.5.0-sun/bin/java
/usr/share/java/libgcj-java-placeholder.sh - priority 100
slave ControlPanel: (null)
slave keytool: (null)
slave orbd: (null)
slave policytool: (null)
slave rmid: (null)
slave rmiregistry: /usr/bin/grmiregistry
slave servertool: (null)
slave tnameserv: (null)
slave jre_exports: (null)
slave jre: (null)
slave javaws: (null)
slave java.1.gz: (null)
slave javaws.1.gz: (null)
slave keytool.1.gz: (null)
slave kinit.1.gz: (null)
slave klist.1.gz: (null)
slave ktab.1.gz: (null)
slave orbd.1.gz: (null)
slave policytool.1.gz: (null)
slave rmid.1.gz: (null)
slave rmiregistry.1.gz: /usr/share/man/man1/grmiregistry.1.gz
slave servertool.1.gz: (null)
slave tnameserv.1.gz: (null)
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1420
slave ControlPanel: (null)
slave keytool: (null)
slave orbd: (null)
slave policytool: (null)
slave rmid: (null)
slave rmiregistry: /usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
slave servertool: (null)
slave tnameserv: (null)
slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-gcj
slave jre: /usr/lib/jvm/jre-1.4.2-gcj
slave javaws: (null)
slave java.1.gz: (null)
slave javaws.1.gz: (null)
slave keytool.1.gz: (null)
slave kinit.1.gz: (null)
slave klist.1.gz: (null)
slave ktab.1.gz: (null)
slave orbd.1.gz: (null)
slave policytool.1.gz: (null)
slave rmid.1.gz: (null)
slave rmiregistry.1.gz: (null)
slave servertool.1.gz: (null)
slave tnameserv.1.gz: (null)
/usr/lib/jvm/jre-1.4.2-sun/bin/java - priority 1423
slave ControlPanel: (null)
slave keytool: /usr/lib/jvm/jre-1.4.2-sun/bin/keytool
slave orbd: /usr/lib/jvm/jre-1.4.2-sun/bin/orbd
slave policytool: /usr/lib/jvm/jre-1.4.2-sun/bin/policytool
slave rmid: /usr/lib/jvm/jre-1.4.2-sun/bin/rmid
slave rmiregistry: /usr/lib/jvm/jre-1.4.2-sun/bin/rmiregistry
slave servertool: /usr/lib/jvm/jre-1.4.2-sun/bin/servertool
slave tnameserv: /usr/lib/jvm/jre-1.4.2-sun/bin/tnameserv
slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-sun
slave jre: /usr/lib/jvm/jre-1.4.2-sun
slave javaws: /usr/lib/jvm/jre-1.4.2-sun/javaws
slave java.1.gz: /usr/share/man/man1/java-java-1.4.2-sun.1.gz
slave javaws.1.gz: /usr/share/man/man1/javaws-java-1.4.2-sun.1.gz
slave keytool.1.gz: /usr/share/man/man1/keytool-java-1.4.2-sun.1.gz
slave kinit.1.gz: /usr/share/man/man1/kinit-java-1.4.2-sun.1.gz
slave klist.1.gz: /usr/share/man/man1/klist-java-1.4.2-sun.1.gz
slave ktab.1.gz: /usr/share/man/man1/ktab-java-1.4.2-sun.1.gz
slave orbd.1.gz: /usr/share/man/man1/orbd-java-1.4.2-sun.1.gz
slave policytool.1.gz: /usr/share/man/man1/policytool-java-1.4.2-sun.1.gz
slave rmid.1.gz: /usr/share/man/man1/rmid-java-1.4.2-sun.1.gz
slave rmiregistry.1.gz: /usr/share/man/man1/rmiregistry-java-1.4.2-sun.1.gz
slave servertool.1.gz: /usr/share/man/man1/servertool-java-1.4.2-sun.1.gz
slave tnameserv.1.gz: /usr/share/man/man1/tnameserv-java-1.4.2-sun.1.gz
/usr/lib/jvm/jre-1.5.0-sun/bin/java - priority 1503
slave ControlPanel: /usr/lib/jvm/jre-1.5.0-sun/bin/ControlPanel
slave keytool: /usr/lib/jvm/jre-1.5.0-sun/bin/keytool
slave orbd: /usr/lib/jvm/jre-1.5.0-sun/bin/orbd
slave policytool: /usr/lib/jvm/jre-1.5.0-sun/bin/policytool
slave rmid: /usr/lib/jvm/jre-1.5.0-sun/bin/rmid
slave rmiregistry: /usr/lib/jvm/jre-1.5.0-sun/bin/rmiregistry
slave servertool: /usr/lib/jvm/jre-1.5.0-sun/bin/servertool
slave tnameserv: /usr/lib/jvm/jre-1.5.0-sun/bin/tnameserv
slave jre_exports: /usr/lib/jvm-exports/jre-1.5.0-sun
slave jre: /usr/lib/jvm/jre-1.5.0-sun
slave javaws: /usr/lib/jvm/jre-1.5.0-sun/bin/javaws
slave java.1.gz: /usr/share/man/man1/java-java-1.5.0-sun.1.gz
slave javaws.1.gz: /usr/share/man/man1/javaws-java-1.5.0-sun.1.gz
slave keytool.1.gz: /usr/share/man/man1/keytool-java-1.5.0-sun.1.gz
slave kinit.1.gz: /usr/share/man/man1/kinit-java-1.5.0-sun.1.gz
slave klist.1.gz: /usr/share/man/man1/klist-java-1.5.0-sun.1.gz
slave ktab.1.gz: /usr/share/man/man1/ktab-java-1.5.0-sun.1.gz
slave orbd.1.gz: /usr/share/man/man1/orbd-java-1.5.0-sun.1.gz
slave policytool.1.gz: /usr/share/man/man1/policytool-java-1.5.0-sun.1.gz
slave rmid.1.gz: /usr/share/man/man1/rmid-java-1.5.0-sun.1.gz
slave rmiregistry.1.gz: /usr/share/man/man1/rmiregistry-java-1.5.0-sun.1.gz
slave servertool.1.gz: /usr/share/man/man1/servertool-java-1.5.0-sun.1.gz
slave tnameserv.1.gz: /usr/share/man/man1/tnameserv-java-1.5.0-sun.1.gz
Current `best' version is /usr/lib/jvm/jre-1.5.0-sun/bin/java.
[dilgarr@Eng-Lab-054 ~]$

I saw somewhere (Sun's web-site I believe - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6188963) that the Java Web Start problem on Fedora Core 3 is "fixed" in Sun's Java v 1.5.0_02 but I have not had the time to figure out how to uninstall Java v 1.5.0_01 and install v 1.5.0_02 (note that the JPackage files for v 1.5.0_02 are now available on their web site -- www.JPackage.org).

Anyone have experience uninstalling a JPackage installation?

My instructions for installing Java on Fedora Core 3 following Michael's proceedures (slightly modified) can be found on http://www.offramp.com/cgi-bin/Lab-Install under "System Administrator's tasks".