Skip to content

Instantly share code, notes, and snippets.

@amusarra

amusarra/Launcher

Created Jan 13, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.