How I learned to stop worrying and love OS X for Java development

I recently acquired a nice 17 inch MacBook Pro to replace my not too old but way too bogged down Windows machine.  I’ve primarily been developing in Java on the Windows platform for eight years.  In that time, I’ve come across a lot of tips, tricks, and tools to increase productivity and generally make life easier.  This post discusses some of the equivalent tips, tricks, and applications in OS X with a focus on free solutions.

Having spent so much time in Windows, I was somewhat nervous about how I would adapt to the Mac way of doing things.  I am certainly not what you would call a Steve Jobs fan-boy and I was ready to slap Linux/Windows on the thing after a couple weeks if it wasn’t working out.  Overall, the migration has been relatively painless and there are only a few nagging things I feel like I need to resolve.  I don’t hate Windows, but the amount of superfluous corporate bloat on the Windows machine made the simple act of rebooting into a 5 minute ordeal, not to mention the mess that 20 Subversion based source code checkouts caused when compounded with the virus scanner and the backup software.

Being an open source developer and loving anything free, as in beer and speech, this article will focus on free applications even if there is a more capable commercial solution available.  I hope this article saves you some time on your journey from Windows to OS X as your Java development platform.

Java Development Tools

Installing the JDK

It is pre-installed.  The version you get depends on the version of OS X you have installed.  I’m lucky and only need Java 1.6 right now so I haven’t had to deal with the concurrent Java versions problems that don’t seem to be going away any time soon; however, there is no free lunch in software development.  The system JDK does not come with src.jar, nor should you probably go mucking around in there customizing the endorsed directory or other common developer tweaks.

Since the bundled JVM isn’t the blessing it initially appears to be, I ended up downloading the JDK again from Apple at  This site requires registration.  You can register for free as a “Registered Apple Developer”.  This may not be immediately obvious as most pages only mention the paid options.  Got to to create your account and then go back to to download a JDK for your version of OS X.  This JDK will install in /Library/Java/JavaVirtualMachines instead of /System/Library/Java/JavaVirtualMachines.  This JDK also comes with src.jar.  You will want to use this JDK in Eclipse or associate its src.jar with the JARs in the bundled JDK if they are the same version and you don’t want to use the self-installed JDK for some reason.

Looking at the JDK files

Java installations on OS X are packaged in what appears as a file ending with .jdk in Finder.  If you right-click in Finder and select “Show Package Contents”, you can get at the guts of the installation in Finder.  The .jdk “file” is just a directory and you can navigate to it and through it in the shell without issue.  The typical folder structure you see on Windows is located in the Contents/Home folder inside of the .jdk “file”.  This is the path you would point Eclipse to when adding a JDK.  Note that you will likely need to paste the path into Eclipse because the Java file browser wouldn’t navigate into the .jdk file when I tried to do it that way.  Just paste the complete path into Eclipse, for example /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home.

Picking the default Java version

In general, this is controlled by the Java Preferences application located in /Applications/Utilities.  You can launch it from the Dock or from a shell with the following command

open /Applications/Utilities/Java\

By the way, applications in OS X appear as a .app file.  Just like the .jdk file, they are really a directory that appears as a file in Finder.  You can view the contents in Finder the same way you would view the contents of a .jdk file.  There are other, more brute force approaches to changing the Java version, but I thankfully haven’t had to use them.  I can’t comment on how well they work so I won’t include a discussion of them here.

Maven and Ant

Maven and Ant were pre-installed on my OS X 10.6 installation.  The pre-installed versions I got thankfully aligned with the versions I am currently using for development so I haven’t needed to mess with either of these yet.


I primarily use Eclipse these days.  Just download extract and run  Install your regular plug-in set and you are on your way to developing in Java on OS X.  I cover installing Subclipse in the version control section later in the article.

General Tools

  • Instant Messaging (AIM, Jabber, etc.) – I was using Pidgin so Adium was the natural choice on OS X.  I have been very happy with it so far.
  • IRC – I was using X-Chat on Windows and found that it did what I needed it to do.  There is a X-Chat Aqua for OS X; however, I found its notification configuration to be a bit daunting.  I don’t watch the chat traffic unless I get mentioned and I found that Colloquy made it very straight forward to configure notifications.  If you play with the themes a little you can also configure the layout to mimic X-Chat or mIRC.
  • New Feeds / RSS – I was using FeedDemon on Windows.  NetNewsWire comes close to the feature set of FeedDemon with Google Reader integration, but it currently lacks OAuth support so you can’t use it to read your Twitter stream.
  • SSH / Putty – OS X, being all unix like, has SSH already available from the shell.  One thing I liked about Putty was that it was easy to store configurations for server names, tunnels, etc.   JellyFiSSH provides a nice session management GUI over the ssh program.
  • File Transfer / SCP/ SFTP – On Windows, I found WinSCP to provide a nice GUI for managing files on a remote system.  In OS X, Cyberduck provides the same features and more.
  • Task Manager – The OS X equivalent is called Activity Monitor.  It is in /Applications/Utilities.  Activity Monitor provides everything that was available in Task Manager and a lot more.  This is a nice GUI alternative to using ps in a shell.
  • Multiple Monitor Utilities – On Windows I’ve used a number of tools over the years to mimic Exposé/Spaces and to put a fully functional task bar on my second monitor.  Exposé and Spaces are part of OS X; however, I found it annoying to have to go back to the primary monitor any time I wanted to use a menu in a program.  SecondBar clones most of the primary menu bar and lets you move it wherever you want.  Sometimes it gets out of synch with the current app and you have to switch focus from the app and back again to update it.  Otherwise, it does what I want.  UPDATE: I stopped using this application a couple weeks after authoring this post due to perceived performance issues with the application running and general flakiness with the second bar actually working.
  • Archive File / WinZip – While later versions of Windows have built-in support for .zip files, WinZip was great for opening .jar files and doing more advanced archival operations.  OS X has native support for archives; however, this support only seems to include the ability to make them and extract them in their entirety.  Zipeg allows you to explore a number of archive formats and extract portions.  Zipeg does not provide Quick Look support though nor does it have every feature under the sun.  BetterZip, a commercial application, has more features than Zipeg but will cost you $20.  As I mentioned earlier, I am a big fan of free, so I use the free BetterZip Quick Look Generator for quick look support and Zipeg when I actually need to dig into an archive and muck around.
  • Text Editing / Notepad++ – On Windows I loved Notepad++ and the many plug-ins available for it.  I do a lot of work with XML messages and output files so something with tabs, syntaxt highlighting, and compare/diff support is critical.  On the free front, TextWrangler gets the job done.  Since a lot of the XML I work with is not formatted for human consumption, the ability to pretty print XML is a must have.  Text Wranger does not have this capability out of the box, but it can integrate with shell scripts to get the job done.
  • Open Command Here – On Windows, the Open Command Here Power Toy was a life saver. Ever need a shell opened to a folder you were browsing in Explorer?  This little context menu addition made it a snap.  There are a number of Finder droplets that will perform this action in OS X; however, I prefer the action to reside in the context menu and I couldn’t stand how the droplets interpreted the root folder in list view as the current folder even when I highlighted another folder.  Open Terminal Here Service to the rescue.  This one places the entry in the context menu and works with the folder you right-clicked on.

Version Control


On Windows, TortoiseSVN coupled with the command line tools and svnmerge covered my needs.  Svnmerge is written in Python and transitions to OS X without a hitch, unfortunately, there is no full featured free alternative to TortoiseSVN.  I got close enough using a combination of the following tools:

  1. Subclipse – The fantastic Eclipse plug-in that you should be using even if you aren’t on OS X.
  2. Subversion – Aside from being the easiest way to get Subclipse working, this also provides the rest of Subversion in binary form.
  3. SvnX – Not quite TortoiseSVN; however, it does have a repository browser and support for working with local Subversion working copies.  This is a nice tool when you don’t want to fire up Eclipse just to browse a remote repository.
  4. SCPlugin – This aims at providing TortoiseSVN like features for OS X, but is still way too immature to make the comparison. The directory icons don’t work in OS X 10.6; however, the Finder droplet does work and provides a quick way to do simple SVN commands in Finder until you are ready to just move completely to the command line.  This one will likely be removed in the next couple weeks as I don’t use it often.  UPDATE:  I stopped using this application/plug-in due to its general lack of features at the time or this post and the lack of working icon overlays in 10.6/7.


I was not a big Git user on Windows; however, everyone seems to be in a love affair with Git so I will cover it here.  My Git environment on OS X is as follows:

  1. EGit – This is like Subclipse, but for Git.
  2. Git – This provides the command line tooling for Git.
  3. GitX – GitX provides a polished GUI when compared to the GUI bundled with the Git tooling and also provides a GUI for helping you to stage files for a commit.  There is some overlap with what EGit provides, but as with TortoiseSVN and SvnX, it is nice to have a tool outside of Eclipse sometimes.
  4. OpenInGitX – Not the context menu item I long for, but it does provide a droplet for Finder that allows you to launch GitX on a folder from the Gui.

Things that OS X just doesn’t make easy

Closing the lid without going to sleep

Every time you close the lid, OS X puts the laptop to sleep.  I really hate this because I often move around in the same building and I don’t want all of my network connection to time out when I do.  Digging out key fobs to reconnect to a VPN and finding that the 600MB .iso download died gets old fast.  InsomniaX lets you shut the lid without putting the machine to sleep.  UPDATE: Insomnia X 1.x and 2.x did not work on OS X Lion when I tried them shortly after the Lion release.  I have just learned to live with keeping the lid open for now.

Locking the laptop without logging out

You don’t want to log out and close all of your running applications every time that you need to get a drink, stretch your legs, or go to the bathroom.  I’ve found two main ways to deal with this.

  1. If you have the system configured to lock the laptop when resuming from screensaver/screen blank, you can press Shift-Control-Eject to turn off the monitor.  The machine will lock after the grace period defined in your system preferences.
  2. You can enable fast user switching or use any of the couple other methods outlined here.

Setting environment variables for shell and GUI applications

For the shell, you can simply use any of the well-known ways to set environment variables.  But what do you do if your GUI application requires the variables too.  OS X stores variables in ~/.MacOSX/environment.plist (note you won’t be able to see this in Finder by default and you will probably have to create it yourself).  Plist files are XML files these days, but it helps to have an editor.  There is an editor in the XCode bundle, but that is 650MB that expands to several GBs of stuff that you probably won’t use a lot.  Pref Setter is a lightweight editor for .plist files that also shows you many of the .plist files on your system that are waiting for you to tweak.  This article discusses creating an environment.plist file.  Keep in mind that you will need to log out and back in before the changes take place.

Showing hidden files in Finder

Finder doesn’t show you hidden file.  Finder doesn’t have an accessible configuration option to show you hidden files.  Finder drives me crazy most of the time.  With this tip, you can bend Finder to your will and hopefully stay sane a little longer.  From a shell, you can execute the following commands to enable how and hide hidden files in Finder, respectively.

defaults write AppleShowAllFiles TRUE

defaults write AppleShowAllFiles FALSE

After making this change, you will need to restart finder.  You can do that by option clicking on Finder in the dock and selecting relaunch.  I wrote a simple shell script that sets the property and put it in a folder on the path.  This makes it simple to run the script from anywhere in a shell, although I don’t think I have turned hiding back on for weeks now.

Setting the title of a Terminal window

I usually have more than one Terminal window open and often I have a couple tabs in each window.  With so many sessions open and nothing really differentiating between them visually in Exposé, I find it nice to name the windows/tabs for easy identification.  In Windows, the title command allowed you to easily set the window title.  The following command will change the title of the Terminal window or tab.

echo -n -e "33]0;<YOUR_TITLE_HERE>07"

That is a lot to remember so I recommend replacing <YOUR_TITLE_HERE> with $1 and putting this in a script named title.  Put the script on the path and you can execute


from anywhere in a shell.

Opening two instances of the same application

Click on the alias or the .app file as many times as you like, OS X isn’t going to do it.  I often run two copies of Eclipse, one for stuff I am working on related to this blog or an open source project, and another with client code.  I switch back and forth and don’t always want to close one instance and lose its current state.  My machine has 8GB of memory so it really doesn’t care if I leave another copy of Eclipse running all day on another screen.  You can launch a separate instance of Eclipse from the shell using the following command.

open -n <PATH_TO_APP_FILE>

How Trash works on your hard disk and on removable media

This article explains how Trash works in general and on removable media of varying types.  I was a little surprised when I deleted a file off of a thumb stick only to find that the stick was still full because the file ended up in the trash folder on the thumb stick.  Give the article a read so you know what to expect.

Things I haven’t figured out yet

The following is a short list of stuff that I wish worked or for which I haven’t yet found a way around.

  1. Native VPN client support for split DNS.  Support for this configuration in OS X 10.6 is just broken.
  2. Finder kills me sometimes.  I wish it had tabs, dual view, or at the very least a folder tree view like Explorer did in Windows.  I’ve seen a number of commercial add-ons or replacements, but haven’t tried any yet.
  3. A “move to other monitor and resize proportional” button in the title bar of windows.  UltraMon had this in Windows and I found it very useful since I have my external monitor in portrait orientation and windows moved from one monitor are often inappropriately sized on the other.
  4. Deleting something from Finder without going through the trash first, as with shift-delete in Windows.  I’ve seen a number of scripts, but I haven’t been brave enough to try any yet.

If anyone has recommendations for these unresolved items, or suggestions relating to any of the things mentioned in this article, leave a comment and I will check it out.

This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

6 Responses to How I learned to stop worrying and love OS X for Java development

  1. Ben O'Day says:

    great article David…I’m preparing for the leap to Mac myself and this gives me a bit more motivation to do so.

  2. Pingback: How I learned to stop worrying and love OS X Lion for Java development | David Valeri's Blog

  3. Petrus Boberg says:

    Thank you for this great article! I’m looking into doing some simple app development on OS X, and I’m sure this info here will be useful once I get started.

    I’d like to take the opportunity to give something back to you. I agree with you that using Finder can be a pain sometimes (read ‘most of the time’), and Finder was therefore one of the first things I replaced when I moved to Mac about two years ago.
    The solution for me has been PathFinder It has dual view, tabs, built in terminal, etc. Give it a try!
    Another possible Finder replacement is Forklift 2 which similar to PathFinder. I haven’t tried my self, but a friend of mine likes it a lot because it has built in FTP/WebDAV/and what not client.


    • cozappz says:

      It’s been a pleasure to see another mac switcher who managed to get along with the quirks of osx.
      Both PathFinder and Forklift2 costs money and the veal period is only 30 days, so they are not high on my favorites list.
      Other tools, which I found extremly useful for easing the transition pain, are Araxis Merge (awfully expensive but extremely useful), UltraEdit (not as capable as its Win version) and BootCamp (thank God).
      BetterTouchTool is a good addition for “single-button” Apple Magic Mouse (I doubt there is any magic in this mouse, but, …whatever)

  4. Babak Vahdat says:

    Hi David,

    same as you I’m also a newbie to Mac OS X (since December 2011) and did really enjoy reading this blog entry of yours.


  5. Babak Vahdat says:

    Hi again David,

    right before setting up Jad & Jadclipse (Eclipse INDIGO) worked also fine for me (the same steps as I always used to do under Windows). Now even using my Mac (as on Windows) I can decompile and see the source of the classes like “sun.misc.Unsafe”

    For my iMac (Mac OS X version 10.7.3) I used the following version of Jad:

    And the version 3.3 of Jadclipse:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s