This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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.
An IDE is no substitute for an Intelligent Developer.
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.
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.
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.
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.