AppBundler: wrong working directory

Alan Bateman Alan.Bateman at oracle.com
Sun Sep 16 03:07:13 PDT 2012


On 15/09/2012 21:04, Steve Hannah wrote:
> Sorry to revive an old thread, but I'm having some trouble on this exact
> issue, and the CWD approach doesn't seem to work on Lion.
>
> A solution that works (for setting the CWD) on Mountain Lion (with or
> without Sandboxing) is:
>
> 1. In the appbundler ANT task
> <option value="-Duser.dir=Contents/Resources"/>
>
> 2. In the Application's main() method:
> System.setProperty("user.dir", new File(".").getCanonicalPath());
>
> The 2nd part is necessary to avoid the following errors whenever you try to
> access the file system in any way:
>   java.lang.RuntimeException: default directory must be absolute
I haven't been following this thread but just to mention that user.dir 
is a "read-only" property, setting it on the command line via -D or 
setting it the main method has always been "not supported".

-Alan



More information about the macosx-port-dev mailing list