Showing posts with label jdk. Show all posts
Showing posts with label jdk. Show all posts

Thursday, November 19, 2009

Silent JDK Deployment on Windows

It's pretty easy to find documentation on how to silent install JREs, but for some reason it's hard to find a full example for silently deploying recent JDKs. Today I needed to deploy 20 JDKs or so, so I decided to tackle this. I needed to deploy JDK 1.6.0_17 (both 32-bit and 64-bit varieties). Since they're build machines, I don't really want the public JRE installed, which may have auto update notifications.

Doesn't Hudson know how to automatically install JDKs now, you ask? Why yes, it does, but it doesn't always have the latest JDK updates. Apparently update 18 fixes some obscure issue that one of our customers has, and according to Ninite it is already out, but I can't yet find it on java.sun.com.(Apparently snapshot releases can be found here.)

After deducing the JDKs use an MSI installer (although packaged within an exe), I enabled verbose logging and found out the names of the feature groups:
  • PublicjreFeature
  • JavaDBFeature
  • DemosFeature
  • SourceFeature
  • ToolsFeature
These are the important part, as they are what you specify using ADDLOCAL=list,of,features to determine which features are selected during silent install. To find any other general install options, all you need to do is run "msiexec" at a command prompt and it will pop up a dialog of options. Thanks to AppDeploy's page on the JDK I also found out some other info (like where the JDK .msi gets extracted to - you can use Orca to examine the MSI file if you're really curious).

On to the point, to perform a silent installation (in this case jdk 1.6.0_17), simply do:

jdk-6u17-windows-i586.exe /qn ADDLOCAL=ToolsFeature,SourceFeature,JavaDBFeature INSTALLDIR=c:\jdk1.6.0_17 REBOOT=ReallySuppress
  • /qn means "No UI"
  • INSTALLDIR is self explanatory
  • REBOOT has a few options, I chose ReallySuppress
  • ADDLOCAL - Specify a comma-separated list of features you want from the list shown earlier, or you can use ADDALL
I saw a lot of examples listing: /s /v"/qn ADDLOCAL=ALL ... ...", this seems to spring from the Java 5 JRE silent deployment guide, but it really need not be that specific. Maybe /s and /v provide some value if an error occurs, but the  /v"/qn OPTIONS..." seems a bit silly, and I am surprised it even works that way.

At last, I have my auto install script that I can remotely run on a bunch of machines with PsExec.

Saturday, August 22, 2009

Avoid JDK 1.6.0_14 for development (missed breakpoints while debugging)

I've occasionally had some debugging pains with Eclipse recently - I've been using JDK 1.6.0_14 for a while. As it turns out, there is a bug in the JDK that causes breakpoints to be missed when debugging.

If you are using JDK 1.6.0_14 to develop, upgrade to JDK 1.6.0_16 - it was released to fix this single bug. (you also as a benefit get 1.6.0_15's security updates)

This caused me some headaches, as it didn't always miss my breakpoints in the debugger, only occasionally... I didn't realize the core problem until a coworker informed me.

Here's a link to the bug:

Release notes for 1.6.0_16:

Download links to the JDK are somewhat cryptic looking, but here goes:

If that fails for any reason, just go to java.sun.com, click on Java SE on the right, and there should be a JDK 1.6.0_16 (non EE) link on the page.