JavaAppLauncher and working directory
Abu Abdullah
falcon.sheep at gmail.com
Thu Apr 10 14:00:56 UTC 2014
>
>
> I believe the way this works is that any jars in the Java directory are
> added to classpath _but_ the Java directory itself is not classpath. The
> Classes directory it contains is in classpath.
>
> For example:
>
> set java.class.path
> java.class.path=/Users/mjh/HalfPipe/HalfPipe7.app/Contents/Java/Classes:/Users/mjh/HalfPipe/HalfPipe7.app/Contents/Java/antlr-2.7.7.jar:...[Other
> jars in the Java directory automatically
> added].../Users/mjh/HalfPipe/HalfPipe7.app/Contents/Java/weka.jar
>
> Notice Java directory itself not there. Java/Classes is there.
> So that you can access resources off of that with something like...
>
> try {
> ClassLoader cl = new java.net.URLClassLoader(new java.net.URL[0]);
> BufferedReader rdr
> = new BufferedReader(new InputStreamReader(cl.getResourceAsStream("Scripts/loader.js")));
> jsEngine.eval(rdr);
> }
> catch (Exception ex) {
> ex.printStackTrace(org.cmdline.common.Configuration.getSysOut()); }
>
> Where Scripts/loader.js is located in the above mentioned Classes
> directory.
> user.dir I would still suggest is not a reliable way to access application
> files going forward.
>
>
Thanks for the tip, it is working if i do so. I was hoping not to change
the code since it was just working fine with JavaApplicationStub.
More information about the macosx-port-dev
mailing list