Monday, October 29, 2007

Apple - When will OS X Leopard have JAVA 6

When I first started reading about leopard, the new iMAC became the iDrool in my eyes. Everything looked to be there. I was itching to get a MAC to use along side linux. Possibly even replace it over time.

When I found out that JAVA 6 was not included because Apple did not have it ready in time for leopard, I became concerned. I used to use OS/2 and found that same thing. I would see a new version of something come out for other operating systems and finally OS/2 month later. It was just not a priority. I don't like the idea of MAC becoming the same thing. MAC should be cutting-edge. As far as I can see, they are cutting-edge except for this JAVA 6 in leopard issue.

I personally wish that Apple would:
  • address why it was not included via some kind of press release.
  • tell developers and users where JAVA stands in their vision of OSX. Is it core to the OS or a "nice to have" toy?
  • tell us what consumers/developers can expect with future releases. (delay or availability when it is officially released by SUN). Are delays going to be a common experience for JAVA developers.
I think this would cool my jets and other too. Either way, I am now less confident in getting a MAC. Linux will remain my platform until I get a clearer view. I know it would drive me crazy using my XP system at work with the latest java, my laptop at home with the latest java but my MAC with one version back.

13949712720901ForOSX is here because of this.

Friday, October 26, 2007

Java Everywhere - SUN Microsystems

I found this on Igor Minar's blog. Not only is this nicely put together but I can buy into it.



Enjoy!

Friday, October 5, 2007

HOWTO: install/upgrade SUN Java under linux

Overview
For those of us using a flavor of linux that does not come with SUN Java (which is currently most of us), you may have run into a bit of a problem. Linux distros typically bundle the the GCC GCJ compiler. Sure, it is probably nice and all but I personally prefer SUN Java. It is what is installed on most non-linux based computers out there. It is the standard.

I, like others out there, have probably tried to remove GCJ from their systems. Well, it is not easy since everything Java that comes with the distro is bound to it. Arg!

The next option is to see if you can get SUN Java and GCJ to co-exist, so you install SUN Java anyway, and run
java -version. You still see GCJ's version. Arg! Why? because the GCJ's java is in the path.

You could setup all the path and JAVA_HOME/JAVA_PATH environment variable but, for me, that is just not enough. I want my environment to just use SUN Java. Outside of simply having 1 flavor of Java installed, this is the way to go. Make SUN Java the default Java.


Purpose
The following will describe the rather simple process for getting SUN Java to be the default Java. This is being done under Fedora Core 6 and 7 (RPM based), however, the technique should work for other distros. I am using SUN Java JDK 6 and am upgrading from 6u2 to 6u3. The process of upgrade or install is the same except for removing the old version :-) The most important aspect is the steps to follow.


Required Downloads
The example will be done installing SUN Java JDK 6 Update 3 (6u3) to replace SUN Java JDK 6 Update 2 (6u2).
  • download SUN Java
    • Site: http://java.sun.com/
    • I used the RPM based install package called jdk-6u3-linux-i586-rpm.bin
  • download java-1.6.0-sun-compat-1.6.0.xx-1jpp.i586.rpm where xx is your update version (01, 02, 03,..)
    • Site: http://www.jpackage.org/browser/
    • In this case, we are trying to download a sun-compat for JDK 1.6.0.03 or 6u3. That is what I hope to find...
    • If a version for your JDK is not available, go on to step #3. This is my case for this example.
  • download the source file java-1.6.0-sun-compat-1.6.0.xx-1jpp.src.rpm where xx is the latest available version.
    • Site: http://www.jpackage.org/browser/
    • At the time of the writing, 1.6.0.02 was the only sun-compat available which is a version behind 6u3. This is ok.

Install/Upgrade
  • Install SUN JAVA
    • command: sh jdk-6u3-linux-i586-rpm.bin
    • agree to the terms by typing "yes"
    • You will see it install a bunch of RPMs into /usr/java/ and /opt/sun/
  • If your java 1.6.0-sun-compat RPM version matches your JDK...
    • command: rpm -Uvh java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm
    • you are done
  • If it does not match then install...
    • command: rpm -ivh java-1.6.0-sun-compat-1.6.0.02-1jpp.src.rpm
    • as above, version 02 was the only version availble
    • you are not done yet.
If the 2nd bullet passed and your JDK version (6u3 in my case) matches the sun-compat version (1.6.0.03) then you are done and can do any clean-up (see below). If you type java -version at a prompt, the version number should be as expected. Otherwise...


Creating your own sun-compat RPM (where sun-compat <> JDK)
Well, you were eager and could not wait for the jpackage guys to create a java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm for you. You just want the latest JDK working. Sound like me. No problems. You have already download the source file (java-1.6.0-sun-compat-1.6.0.02-1jpp.src.rpm or similar) so you can make your own. You have also installed it (3rd bullet above).

To make your own sun-compat RPM just do the following:
  • cd to /usr/src/redhat/SPECS/ (the source directory may be different on other distros)
  • edit java-1.6.0-sun-compat.spec using your favorite text editor
  • At the top of the file you will see %define buildver 02
    • For this example we want 6u3 so buildver should be changed from "02" to "03".
  • Save and close the file.
  • Make your RPM
    • command: rpmbuild -ba java-1.6.0-sun-compat.spec
    • stuff happens...
  • Look in /usr/src/redhat/RPMS/i586/ and you will see java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm
  • install it
    • command: rpm -Uvh java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm
As above, you should be able to run java -version and see (as in my case)

java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)


That is it.


Clean-Up After Successfull Install/Upgrade
Once you are sure everything is using the new version, you can (if desired) rpm -e your old jdk. Since SUN JDK 6 creates a symlink from the current version as "latest" there isn't much risk of using the old version... I did say "much" risk. I prefer removing the old once I confirm the new one is safe and stable.


Netbeans
To tell programs like Netbeans (we are all using it after all) to use the new JDK, simply update the JDK version in $NETBEANS_HOME/etc/netbeans.conf where $NETBEANS_HOME is the location of the netbeans install. That will affect all users of that install globally.


Java WebStart
I love WebStart, however, for some odd reason, desktop shortcuts created for linux (GNOME) hard code the full path (including version) to the javaws program. This is stupid since they should really just point to "latest". Regardless, you can either de-install/re-install the Java WebStart apps, or do the lazy approach and just edit the *.desktop files in your ~/Desktop/ directory. Just update the JDK version to match the current version.


Final Thoughts
This may seem like a long process but the steps are basic and easy. I keep the sun-compat source installed on my system and update the version number each time a new JDK comes out. I only get a new src and i586 version for new major JDK releases (i.e. JDK 5 to JDK 6). This makes the update process take a few minutes. About the same time it takes in Windows to update the PATH of the System Environment.

I hope these steps help it become easier for you too. I also hope that this blog become obsolete and that linux distros start bundling real SUN Java by default. It just the right thing to do. Some distros are already doing this. Fedora? Do you hear this? :-)

BTW
For Ubuntu, this may work. I need to try it.
http://coffeecokeandcode.blogspot.com/2008/09/installing-java-6-update-10-on-ubuntu.html