Search code examples
javajava-web-startprocessbuilder

JNLP, ProcessBuilder and file hierarchy


Here's the picture:

I have a code split across some jars and libraries in the following hierarchy:

Main.jar
  ---lib
      |
      ------ Secondary.jar
      ------ Lib1.jar
      ------ Libx.jar

The main class in Main.jar calls another main class on Secondary.jar like this:

ArrayList<String> commands = new ArrayList<String>();
commands.add("java");
commands.add("-cp");
commands.add("lib"+System.getProperty("file.separator")
+Secondary.jar+System.getProperty("path.separator")+"lib");
commands.add("<Secondary Main class cannonical path>");
System.out.printl(commands.toString().replaceAll(",",""));
ProcessBuilder pb = new ProcessBuilder(commands);
pb.start();

When I run this from the IDE and/or command prompt (the command that the println output) it works fine. When ran from javawebstart that process fails because it can't find Secondary Main class in the classpath.

I suspect it is related to how JWS handles the downloaded resources and such.

Any idea?


Solution

  • Sun made it impossible for an applet or JWS app. to determine the location on the local file-system at which the app. is installed. It is none of the apps. business to know that.