Adam Bien's Weblog
If The Kindle Previewer Won't Start
Kindle Previewer is a Java application, which seems to require JDK 1.6 and does not run on JDK 1.7.
To fix the environment, open /Applications/Kindle Previewer.app/Contents/MacOS/Launcher and add JAVA_HOME pointing to your JDK 1.6 installation right after #!/bin/sh, e.g. export JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
Posted at 06:36AM Oct 21, 2012 by Adam Bien in Real World Java EE Patterns - Rethinking Best Practices | Comments[1] | Views/Hits: 2553
NEW Workshop: "JPA, NoSQL, Caching, Grids and Distributed Caches with Java EE 7", May 7th, 2013, Airport Munich
A book about rethinking Java EE Patterns
Tweet Follow @AdamBien

Hi Adam,
if one has not yet updated to Apple Java Update 1.6.0_37 you can set the JDK that will be used with Java Preferences.app by reordering the installed JDKs.
Since the last Apple-Update, Java Preferences.app is missing. But there's still another elegant way:
/usr/libexec/java_home
This tool prints the Java-Home Location of the preferred JDK to stdout. So one can use it in scripts by executing:
export JAVA_HOME=`/usr/libexec/java_home`
There are some command line options with java_home, e.g.:
/usr/libexec/java_home -v1.6 -d32 -ai386
will print the JDK location that best fits the desired version = 1.6 with i386 architecture and 32bit.
So /usr/libexec/java_home is perfect for doing this job.
As with Java Apps packaged with Apple Java Packager Tool, a info.plist is created inside the .app directory. There you could also set the desired JDK version - Just set <key>JVMVersion</key> to 1.6 (NOT 1.6+)...
H.t.h.
Robert
Posted by Robert on October 25, 2012 at 08:50 PM CEST #