I'm using the JarBundler Ant task from within Eclipse. A regular Hello World application gets bundled fine. When I try to bundle an application that contains resource files, it can't seem to find them.
Whenever I use:
System.getProperty("user.dir")
from within a .app program created with JarBundler, I get a result of "/" no matter what the working directory is set to in the JarBundler task. The same property when running my program from Eclipse gives me "/Users/StevenF/Documents/eclipse/projects/puzzle carnival/data/", the directory the program happens to be running in.
Here's the relevant part of the Ant build file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <jarbundler dir="${release.dir}" name="${app.name}" mainclass="${mainclass}" jvmversion="1.5+" shortname="${app.shortname}" workingdirectory="./Contents/Resources/" > <jarfileset file="${jar.path}" /> <jarfileset dir="${vendor.lib.dir}" /> <resourcefileset dir="${data.dir}"> <exclude name="**/Thumbs.db" /> <exclude name="**/*.jar" /> <exclude name="error.log" /> <exclude name="LuckysPuzzleCarnival.exe" />
<exclude name="demo license.txt" /> </resourcefileset> </jarbundler> |
I've tried omitting the working directory and tried changing it to a number of things (including "/Contents/Resources/"). I had assumed that it would just sent the working directory to "/Contents/Resources/" in the first place, but that doesn't seem to be the case.
I've even tried hardcoding the full path "/Users/StevenF/Documents/eclipse/projects/puzzle carnival/data/demo/Lucky's Puzzle Carnival.app/Contents/Resources/" within my code with no success.
I've examined the package contents, and all the files are in the right places. The .jar files are in the "Contents/Resources/Java" folder, and the resource files are in the "/Contents/Resources/" folder.
Has anyone else had success with this tool? Does anyone see what I'm doing wrong? I'm not exactly Mac-savvy, so I might be doing something stupid. I've had some problems with other .app-generation techniques as well.