Where’s my JDK?

Caught in the Java depreciation battle under OS 10.6 and can’t find where the Java Development Kit (JDK) now resides? Here’s a command that will tell you, allowing you to still use InteliJ and other IDEs on OS X.

There’s a lot going on with Java at the moment. Oracle acquires Sun, putting the language in squarely in hands that don’t inspire trust; the same thing happened with MySQL. Meanwhile, the Apache Software Foundation quits the Java SE/EE Executive Committee. And now Apple deprecates Java, and the reason doesn’t appear to be what you’d think.

Starting with OS X 10.6.3 update, developers got caught in the back lash. Things moved on the file system.

Upgrading IntelliJ, the IDE was asking me where my JDK was, as it certainly wasn’t where the software, or I, thought it should be.

You won’t find the location using /Applications/Utilities/Java Preferences.app.

But you can find it with some digging. Thanks to this developer release note from Apple, the following command from Terminal will spew out some XML.

$ /usr/libexec/java_home –xml

Find the dictionary section that has ‘x86_64’ in it, and you’ll find an entry that has a ‘JVMHomePath’ with something like:

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

You want to provide this full path to the IDE as where the JDK lives.

It’s worth pointing out that Apple recommends that if you install any 3rd party JVMs they should be installed in /Library/Java/JavaVirtualMachines or ~/Library/Java/JavaVirtualMachines.

Hiding Image Files in TextMate

Here’s how to hide JPG, PNG, and GIF files in your TextMate projects so bulk file operations go faster.

TextMateTextMate, perhaps the best generic programming editor that I’ve ever encountered (though I’d be willing to entertain reader suggestions), has the ability to open an entire directory at once, which is great for making bulk changes to automatically generated website files.

However, there’s one trick that I keep having to look up each time I do it, and that’s how to get that side-bar directory listing of the project files not to display image files. The reason you might want to do this is for efficient global replace options across all text-based site files.

The solution is to click the top-level directory in the project, and press the I button in the bottom right corner of the drawer.

This opens a Folder Information dialog box. In the area labeled Recursively Include Contents Matching there are two fields, one for files and one for folders. In the File Pattern field, enter this regular expression: !\.(jpg|png|gif)$

When you close the Folder Information dialog box, all files with the extensions listed will no longer be displayed.