On Apr 6, 2014, at 11:02 PM, Abu Abdullah <falcon.sh...@gmail.com> wrote:

> 
> Launcher.jar is just a wrapper instead of executing through the command line. 
> it has only manifest.mf file with Main-Class: classes.myapp and other 
> options. the classes are in a folder in the same directory.
>  
> user.dir for app bundler defaults to your user home directory. Trying to 
> access anything off that inside your application bundle can't really be 
> counted on.
> 
> this is my problem, I'm not able to see other folders in the same 
> /Contents/Java. it seems the classes are executed as part of the classpath 
> and not the working directory that it should be in. 


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.

> i will try now with Joe suggestion to go with the new fx packager, it is 
> certainly the way forward.

If this provides equivalent functionality and is active this would probably be 
the way to go. Given the time, I will look at it. Any handy OS X specific 
documentation links would be appreciated.
  

Michael Hall

trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz

HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe

AppConverter convert Apple jvm to openjdk apps 
http://www195.pair.com/mik3hall/index.html#appconverter




Reply via email to