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"


Summer Workshops: From Java EE 7 Bootstrap and Effective Java EE 7 to Java EE 7 Architectures

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

Comments:

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 10:50 PM CEST #

Brilliant!
I've just set up a new Mac and as such installed by default JDK 1.7 -- using the above I've managed to get my Kindle Previewer running right away.
Thanks so much!

Liv

Posted by Liviu Tudor on January 31, 2014 at 07:10 PM CET #

Thanks so much for this Adam. Just downloaded and ran the Kindle Previewer on my mac and began to get confused and irritated when it failed to launch. Luckily your solution worked for me. Cheers

Posted by Eric on February 21, 2014 at 05:19 PM CET #

Thanks!!

Posted by Migs on March 27, 2014 at 04:12 AM CET #

Thanks so much for this information! I use Kindle Previewer to convert epub to mobi and never would have put together that it was a Java issue.

Posted by Dominic on July 12, 2014 at 03:40 PM CEST #

This solution worked beautifully! Thanks heaps!

Posted by Anthony Hortin on September 16, 2014 at 05:41 PM CEST #

I think I followed all of the instructions here correctly but unclear whether I've done it right.

Kindle Previewer still crashes every time I launch. I've never gotten anything to open...I used the command line you suggest above --here's a question that likely shows my ignorance...for "usr" in the command line was I supposed to substitute my user name on my Mac?

I'm running the latest Yosemite (which I updated to partly based on someone's comment that it solved their KP problem to do this)

Not sure what to do next...

Posted by Liza on November 06, 2014 at 10:09 PM CET #

I added the following step after Adam's to get the solution to work for me with Kindle Previewer v2.94. Prepend the string "${JAVA_HOME}/bin/" in front of lines 26 and 29. So these lines start like this:

java -d32 -XstartOnFirstThread...

After the change, both lines start like this instead:

${JAVA_HOME}/bin/java -d32 -XstartOnFirstThread...

If you have no idea where the v1.6 Java is located on your system, then instead of following Adam's instructions, run Robert's command:

/usr/libexec/java_home -v1.6 -d32 -ai386

Hope this helps, thanks Adam.

Posted by Anthony Yen on December 17, 2014 at 07:05 PM CET #

Same for me as Liza, except my OS is Mavericks. The KDP people gave me similar instructions (that don't work) and this link if I needed help.

I found Apple had instructions on abling Java 6, that didn't work either.

I can see the 1.6.0 Java folder, I tried to move the files manually. No luck. I'm stuck, I don't understand where line 26 and 29 are counted from Anthony Yen. Any ideas? Thanks

Posted by Ron on January 22, 2015 at 01:56 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
License