Java and the Retina MacBook Display
I’ve recently converted to the “Cult of Mac” by way of a 15″ MacBook Pro. It’s had its share of issues but it now works well after a replacement LCD. The long-term problem is that not all software plays along well with the Retina display. In particular, Java applications don’t seem to behave too well, and can look terrible. Here are some possible fixes.
Apple used to distribute its own Java Runtime Environment. It was not really kept up to date. Due to a lot of drama over Java security exploits, Oracle took over the responsibility last year. This means you can now download and install the latest Oracle Java (7u15) version directly from their site. Apple is still providing security updates for its own Java6 distribution.
How to make your Java application look sharp:
The trick to making a Java app Retina-ready is to hack its app bundle description. Here are the steps:
- Select “Show package contents” on YourApp.app.
- Edit Contents/Info.plist and at the end (before </dict></plist>) add:<key>NSHighResolutionCapable</key><true/>
- Then logout and log back in.
- Your app will now look sharp!
So what just happened? Well, this works for Eclipse running on Oracle Java7, probably because Eclipse uses SWT (which in turn uses the native OS widgets). But all you’re doing with the above steps is changing metadata, it’s not magic. So for your standard Swing Java apps it won’t do much. What you have to do is run your older apps using Apple’s Java.
For reference here are the (default) locations:
Apple Java6: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
Oracle Java7: /Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/bin/java
So if your app only requires Java6 or earlier, then as of Mac OS X 10.8.2. you’re still OK. Just run it using Apple’s Java after performing the app bundle hack detailed above.
Here’s an example, I wanted to make GATE look pretty. So I simply did the app bundle modification, then hardcoded Apple’s Java path in its shell startup. The end result is nice and sharp:
Dilemma: Going forward (Java7) we’re screwed. Swing apps will look terrible on Retina displays with Oracle’s JVM. See the links I provided for further discussion.
Hope this helps! Have a nice day!