Irimescu Bianca
Irimescu Bianca

Reputation: 41

How can I programmatically find the path of JNLP file? I am using Java Web Start to generate the JNLP file

How can I programmatically find the path of JNLP file?I am using Java Web Start to generate the JNLP file. I know that manually you can find the JNLP file in the Java Cache Viewer in Resources with the name launch.jnlp, but I really need to know if there exists a Java class that can programmatically find the jnlp file by searching the in-memory cache.

Upvotes: 2

Views: 1849

Answers (2)

Andrew Thompson
Andrew Thompson

Reputation: 168825

How can I programatically find the path of JNLP file?

It is hidden deliberately. If you can find it from within code (shorting of asking the user to browse to it), the JRE has a security bug.

..for launching the installer I need the application jar files path

No you don't.

  • Put the installer inside a Jar.
  • Add the Jar to the resources of the app.
  • Get an URL using getResource(String).
  • Read the byte[] and write it to a temporary file at a known location (e.g. java.io.tmpdir).
  • Launch the installer from the known location.

Upvotes: 1

jeffmaher
jeffmaher

Reputation: 1902

String jnlpPath = System.getProperty("jnlpx.origFilenameArg");

Upvotes: 0

Related Questions