Skip to content

Instantly share code, notes, and snippets.

@amusarra
Created January 13, 2015 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amusarra/e7b957b9e2a23e05d0d5 to your computer and use it in GitHub Desktop.
Save amusarra/e7b957b9e2a23e05d0d5 to your computer and use it in GitHub Desktop.
Add JAVA_HOME on Launcher of Kindle Previewer OS X Yosemite
#!/bin/sh
dir=`dirname "$0"`
cd "$dir"
classpath=./:./lib/touchLibs/etc/fonts/fonts
for i in `ls ./lib`
do
classpath=$classpath:./lib/$i
done
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
# start the previewer
fileExtT=`echo $1 | awk -F. '{print $NF}'`
fileExt=`echo $fileExtT | tr '[:upper:]' '[:lower:]'`
if [ "$fileExt" == mobi -o "$fileExt" == azw3 -o "$fileExt" == epub -o "$fileExt" == opf -o "$fileExt" == html -o "$fileExt" == zip ]
then
# opens only the first book in command line. TODO: handle multiple books in command line
java -d32 -XstartOnFirstThread -Dfile.encoding=UTF-8 -cp "${classpath}" com.amazon.epub.reader.Main "$1"
exit 1
else
java -d32 -XstartOnFirstThread -Dfile.encoding=UTF-8 -cp "${classpath}" com.amazon.epub.reader.Main
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment