OS X for Java Developers

Welcome to OS X

I recently purchased a Mac (a Macbook Pro Retina), I had previously worked on Windows (XP/7) and Linux (Ubuntu). Making the switch took some getting used to, these are some of my tips for new developers.

dmg archives

In the Windows world applications are distributed and installed using the .exe format, on OS X we use .dmg files.  These .dmg files are archives, double clicking on them mounts the file system and usually launches an installation wizard. Sometimes installation consists of simply dragging a file to the /Applications directory. In addition to .dmg we also have .app files, these can be launched by double clicking on them or using the open command from the terminal.

Installing Java

The latest versions of Java (Java 7 & Java 8) can be downloaded from Oracle’s website. However older version like Java 6 are no longer available, these can be found on Apple’s developer website.

Java Location

In Windows the common installation location for Java is under ‘Program Files’ or ‘Program Files (x86)’. On OS X you can find the JDKs under the following directories:

  • Java 7 : /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
  • Java 6 : /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Update your ~/.profile

On windows we need to update the System PATH variables, on Unix environments we normally sent environment variables. After installing Java update your .profile to set any needed variables and point to the correct installations, ex:

echo "executing .profile"

# JAVA
export JAVA_HOME=`/usr/libexec/java_home`
export GROOVY_HOME=/usr/local/opt/groovy/libexec

# MYSQL
PATH=${PATH}:/usr/local/mysql/bin

Tools

  • On Windows, Notepad++ is great lightweight editor that supports multiples languages, however the editor is not available for OS X. A great alternative is Sublime Text, this editor cross platform and servers as a great replacement.
    • Sublime includes a command line editor: subl
  • Eclipse seems to work fine on every operations system (Windows, Linux, OS X).
  • Git / Svn / Maven – These tools can be installed independently or we can use a package manager like HomeBrew. HomeBrew is ‘The missing package manager for OS X’, similar to apt / aptitude on Ubuntu.
Advertisements
Posted in Java, Mac, OS X

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: