• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDK on Ubuntu

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic