views:

39

answers:

3

I am working on a project in Java which has a directory structure something like this:

        MainFolder
        /   |     \
Folder1  Folder2  Folder3...
   |
Program.jar|Run.sh

In Folder1 I have main jar file along with the shell script to run the program. In Folder2 I'm having configuration files in xml which may later be modified by the program and In Folder3 I'm having jar files that the main program depends on.

Now I want to deploy this program using Java web-start.My current understanding is that web start allows us to deploy programs using 1 or more jar files.My problem is that I need the directory structure also.Can anyone suggest a solution for this.

A: 

I think you will have to make some changes to the structure for webstart deployment (possibly package it as a jar or set of jars), also the launching will be done via JNLP, by webstart and not Run.sh.

Additionally you will have to sign your deployment if you need permissions to write to the disk.

See the FAQ for webstart here

Also check out the developer guide on how to deploy using webstart

naikus
A: 

Java WebStart does not provide any help in making the filsystem as you need it - it only provides the program components for memory.

If you need this structure, you will need to maintain it yourself (and then, where?)

If the only thing you need is a shell script to run, you can keep the contents of that file as a resource inside your jar, create a temporary file at each run, put the desired contents inside, and execute it, and then delete the temporary file when you are done. Note that this brings you into the wonderful world of code signing which is rather tedious.

Thorbjørn Ravn Andersen
+1  A: 

As mentioned by others, the shell script raises problems. What does it do specifically to 'run the program'?

For the configuration files - 'Folder 2', webstart provides the PersistenceService. I have a small demo. (1)

As far as the Jars in 'Folder 3' go. Move them, as well as the Jar's in folders 2 & 1 to a single directory named 'lib'. The main Jar and the configuration files will be required eagerly, which is the default for JWS. If any of the other Jars (ex. '3') might not be needed immediately or at all, they should be deployed as download='lazy'.

To access the local file system - for reading input supplied by the user or writing a new file they created - a JWS app. normally needs to be digitally signed and trusted. But JWS also provides the much more limited form of access through the FileContents object. For more details, see the demo. of the File Service in the page linked below. (1)

1) Demos of the JNLP API, including the PersistenceService & FileContents object.

Andrew Thompson