Decipher Tools Blog

News about all things iOS, especially backup, recovery, and forensics. Upcoming features for Decipher TextMessage, Decipher Backup Repair, Decipher VoiceMail, and Decipher Backup Browser.

How To Setup AppBundler to Point The Java Working Directory to Your App Resources

Kelly Wilkerson

Categories: development | View Comments

Today we're switching all of our build process over to Ant and bundling our OSX Java programs with AppBundler so we can properly package a JRE with our software. I came across a small problem while doing so: I needed to access resource files in our .app package that were not in a jar file, and I had no idea how to set jre working directory using AppBundler.

If you used javaApplicationStub for your OSX Java software in the past, you likely used to set the WorkingDirectory property inside of your program's Info.plist (to something like $APP_PACKAGE/Contents/Resources/Java or similar). You also likely found this page because you need to know how to set the java working directory to something more useful than the user's home directory using AppBundler.

Here's the line you want inside of your AppBundler task:

<option value="-Duser.dir=$APP_ROOT/Contents/Resources"/>

P.S. Sorry for another software-development article, but I really can't help myself sometimes.