GeeCON Prague 2014*
The moose likes Linux / UNIX and the fly likes JDK on Ubuntu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "JDK on Ubuntu" Watch "JDK on Ubuntu" New topic
Author

JDK on Ubuntu

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hi.
It is me again about JDK on Ubuntu.
I guess you know by now that I have installed JDK6 on Ubuntu 7.10 via Synaptic.
I noted a strange thing:
My installed JDK doesn't contain db and sample directory under JDK_HOME dir, where are they?
One more thing:
Where can I find the "endorsed" dir?
Thanks.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

If you use Synaptic, you need to install the sun-java6-db and sun-java6-demo packages.

The db should be located in /usr/lib/jvm/java-6-sun-1.6.0.03/db and the demo should be located in /usr/share/doc/sun-java6-jdk/demo.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Jeff Rummings
Ranch Hand

Joined: Dec 20, 2007
Posts: 42
Did you try update-alternatives?



If that doesn't work, try manually creating a symbolic link



If you don't have $JAVA_HOME defined, use the actual path to the installation directory.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16095
    
  21

Actually, if you installed Java via Synaptic or apt-get, you got that rather horrible GNU Java. For most serious software development purposes - especially Swing and J2EE - you should download the Sun SDK and install it.


Customer surveys are for companies who didn't pay proper attention to begin with.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hi Tim,
Do you advice me Sir to uninstall my installed-by Synaptic JDK and install Sun's JDK by hand?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16095
    
  21

No, it's not necessary to do that, and in fact there might be apps that would break (possibly OpenOffice, for one).

The great thing about Java for Linux is that you can have multiple JDKs and JREs installed and operating on the machine at the same time and pick the one that works best for the app.

A good practice (and the RPM install does exactly this) is to make a /usr/java directory and install Sun JDK's there. So for example, I have a /usr/java/jdk1.5.0_14 directory and a /usr/java/jdk1.6.0_02, and each one is a separate JDK.

That way, when I want to run an app such as Tomcat or JBoss, I can set JAVA_HOME to point to the appropriate JDK and set my PATH=$JAVA_HOME/bin:$PATH.

You can also setup the Sun JDKs in the Debian alternatives system, which is Ubuntu's answer to multiple software alternatives. However, I've never found that to be very straightforward and it doesn't set environment variables such as JAVA_HOME. While JAVA_HOME's not actually part of Java, it's the conventional place to find a JVM for most complex Java apps.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Thanks Tim for the great explanation.
Before I got an answer to my question in this thread, I created a link to /usr/lib/jvm/java-6-sun/bin/javac and moved it to /etc/alternatives
So, ecj is now properly gone!
Should I expect any exponential problems (possibly OpenOffice or other applications)?
One more thing:
Under /usr/lib/jvm folder, I have two folders:
java-6-sun-1.6.0.03 and the other is a link to the previous folder, its called: java-6-sun
Why Synaptic created this link?
Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16095
    
  21

I'm not too sure about manually creating links for alternatives stuff - usually it's better to let the system do its own housekeeping.

As for the java-6-sun-1.6.0.03 and the java-6-sun, one gives you a generic 1.6 java that can be used without having to update your apps every time a new Java 1.6 release is installed. The other gives you that specific 1.6 release. As new releases come out, the java-6-sun link may be moved to point to the latest and greatest, but if the latest and greatest turns out to have pesky bugs in it, you can ask for a know good version like java-6-sun-1.6.0.03 instead.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

Originally posted by Tim Holloway:
Actually, if you installed Java via Synaptic or apt-get, you got that rather horrible GNU Java. For most serious software development purposes - especially Swing and J2EE - you should download the Sun SDK and install it.

This is not entirely correct. GNU Java is installed by default on Ubuntu, but Sun's Java 6 update 3 is also available in the repository. So it isn't true that you can only get GNU Java when you install Java via Synaptic.

sudo apt-get install sun-java6-jdk

With the update-alternatives command, you can choose which version of Java you want to use by default. After installing Sun Java 6 from Synaptic or via apt-get, it should automatically be set to the default.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDK on Ubuntu