Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

installing java on fedora

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys :

I just got fedora a month ago. I ran the jre installation package for linux, and it said "software was succesfully installed". However - if I go to the files created by the rpm, and go into the bin directory and run java -version, I get a class not found : Object error.

I know that there are other posts regarding this topic - but my question is high level. Why is java 2 so complicated on Fedora ? I used to have java 1.3 installed in my HOME path, but to run java 1.4 I simply downloaded the SDK, and explicitly specified the path to it in my java commands i.e. i could use any version of java by simply specifying the path to the JVM explicitly (i.e. typing something like j14sdk/bin/java -version).

This is so weird ? What did java 2 change that doesnt allow you to run it from a local location on linux ?
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
even weirder ... when i serach for Java / fedora I get all these other new protocols I have to learn (Yum, JPackage, Alternatives) etc. So now it seems like in order to be continue being a java developer I have to learn the Fedora operating system inside and out... but the whole reason why I like java is that its OS independant !!!
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jay vas:
Why is java 2 so complicated on Fedora ?


Some Linux distributions pride themselves on not using commercial, closed-source code. If you don't like that "feature" of Fedora, perhaps you should find a distribution that is more tightly integrated with Java.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18155
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Jay's being zapped by a rather horrible little system called "alternatives". Alternatives was developed for the Debian Linux distro, but is part of modern-day Fedora releases as well. It's designed with the idea that each user on a multi-user system can select their very own preferred version of an application (java, in this case).

There's a certain road and it's paved with Good Intentions. Personally, I find "alternatives" confusing, and I've RTFM'd in detail. Java is very easy to run multiple editions on most OSs (including Linux). Not only per-user, but per-app. Simply setting a JAVA_HOME is enough for many popular apps like Eclipse, WebLogic, Tomcat, etc. Roll-your-own apps can follow that lead (you're actually running $JAVA_HOME/bin/java) in their own execution scripts.

Because Fedora wishes to be "politically correct", the java that comes with Fedora is gcj, which isn't a very complete or powerful implementation. What can make things even worse is not getting the JAVA_HOME/CLASSPATH/PATH settings in sync. You can end up running gcj, but pulling the Sun JVM's classes or similar mischances. Which won't work.

In all cases, if the class java.lang.Object can't be found, you have a basic classpath issue, since jlO is in the jvm lib core.
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay Thanks ... But the really confusing issue is how when I run java 1.4 on Fedora, none of this was ever an issue ?

I just simply launched java as locally executable program i.e.
[jay@snoopy jay]JaysStuff/java/jre1.4.0_01/bin/java HelloWorld.

Why is Java 1.5 any different ?
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Case in point : Look at the installation tutorial for java 1.5 !!! This was not an issue with Java 1.4 because it could run locally !!! Is there something platform specific about java 1.5 that requires it to be tightly integrated with the Operating System ? Is Java 1.5 the first "platform specific" version of Java ?

http://ccl.net/cca/software/SOURCES/JAVA/JSDK-1.5/index5.shtml
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is Java 1.5 any different ?

That sounds like a question for the Fedora contributor mailing list.
I can't speak to installing Java locally. Never tried it. However, I've used two Linux distributions with JDK 1.5: Gentoo and Ubuntu, and both of them had very straightforward install procedures. I use OpenSUSE at work. Compare the OpenSUSE procedure with Fedora's. Much simpler. I just took 10 minutes and now I've got JDK 1.5 in OpenSuse.
Remember that Fedora is a bleeding-edge distribution. It is ment for community testing, not for stability or ease-of-use. If you don't like it, switch. That's part of the "free" in Free Software.
 
Val Pecaoco
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gcj is pre-shipped with Fedora such that the symbolic link /usr/bin/java points to the gcj installation. /usr/bin is automatically added to the PATH env variable by Fedora such that this is what Java programs are getting. What I did for my Fedora Core 5 (and also with my SuSE 10.0 and Solaris 10) was to use a technique mentioned in the Solaris installation guide to install the JDK, essentially bypassing the gcj installation:

"Setting JDK 5.0 to be the default - On Solaris 8 and 9, it is possible for root users to make JDK 5.0 the default Java platform by modifying the /usr/java symbolic link to point to /usr/jdk/jdk1.5.0. On Solaris 9, a root user would modify the /usr/j2se symbolic link to point to the same 5.0 directory..."


I used the self-extracting binary (*.bin) and not the *.rpm version (I am running v1.5.0 update 7) because this can be customized to install in a folder you choose. I installed into /opt and used the instruction above to repoint all the sym links of the JDK tools under /usr/bin to that installation (of course I backed up all the old ones there first).

The Solaris install guide can be found here: http://java.sun.com/j2se/1.5.0/install-solaris.html

After that I got it all running smoothly, but of course the dampener is that you have to know the Solaris install guide beforehand for a workaround.

HTH
[ December 01, 2006: Message edited by: Val Pecaoco ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic