简体   繁体   中英

Java Web Start and Folders

We currently have an Java application that can be deployed on clients or run as a shortcut from the server. We have intermittently received ClassNotFound exceptions when running the JAR from the server which looks like Windows dropping the network connection with only part of the classes from the JAR loaded (user opens a different screen then the problem is apparent).

I am currently looking at the Web Start technology to allow us to run a single shortcut.

However the application has several folders it requires to be in the same folder the JAR is launched (for configuration, logs, etc.). These folders will require full access for all users to allow them to write log files. There are lots of configuration files under the configuration folder hierarchy.

The application also requires access to environment user settings (such as getting their user folder). It also requires certain command line parameters (including which folder to use for configuration, log file location, java memory usage, etc.)

Edit

The application also contains a reference to 2 signed JARs. These are:

  • jh.jar
  • mail.jar

It looks like these are signed by SUN Microsystems. jh is used for help integration in our application whilst mail is used for email integration.

I have now downloaded the latest versions of these files from java2s.com which do not have the signed equivalents.

end edit

The application is developed in Netbeans which compiles a single JAR file and copies the dependant JARs to the dist/lib folder. I enabled the Web Start functionality in Netbeans for the application and it generates the JNLP file.

Bearing everything in mind is Web Start the way to go for an application like this? Can you include folders in a Web Start deployment? I could not find anything to do this in the XML structure for a JNLP file.

Cheers,

Andez

Yes, you could use WebStart for this.

Permission: If you need permission to the file system, you have to sign your jars and put the all-permissions tag in your jnlp.

Arguments: Arguments can be provided by using the arguments elements in application_desc .

Folders: I'm don't think you can include folders in the WebStart application, but you could put the config files in a jar and read them from there, or extract them on startup.

ClassNotFoundError:

We have intermittently received ClassNotFound exceptions when running the JAR from the server which looks like Windows dropping the network connection with only part of the classes from the JAR loaded

Does not sound plausible to me. per default, all jars will be downloaded before the application starts. If you set "download" to "lazy", the jar will be downloaded when first needed, but I would guess it will be downloaded completly then.

You can provide read-only resources for Java WebStart. Getting the log back is harder. I would suggest looking into a centralized logging solution, using one of the standard appenders in the log framework you use.

For a Java Web Start application it is always advised not to create files or folders in the class path. Recommend user's home directory to store your settings or database files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM