简体   繁体   中英

Launching a Java Web Start application upon install4j installation finish

I'm trying to start an install4j Launcher upon installation finish, but it doesn't work. The Launcher works fine as a start menu item though. I have reasons to believe that this is because my application is started through Java Web Start (it has to be for legal reasons).

What happens when clicking the finish button in my install4j installer is:

  1. The installer window disappears and Java WebStart starts (showing its splash).
  2. Nothing more happens (normally my Java application would start here).

By looking in the Java log, I can see that WebStart actually executes my Java app, but that it fails to fully start because the file C:\\Users\\UserName\\AppData\\Local\\Temp\\e4j2E4E.tmp_dir\\jre\\lib\\ext\\dnsns.jar doesn't exist anymore. This directory seem to be the place where install4j temporary places the JRE that it needs to run.

By hitting F5 in a file manager, I can see that the JRE is removed (I guess by install4j) after WebStart has been executed. This would explain why my Java app then fails.

When running the start menu launcher (manually after installation), everything works fine because my Java app is then using the JRE that is bundled with it (in a subfolder of its own).

How can I prevent install4j to remove the temporary JRE, or force WebStart execute my Java app with another (the bundled) JRE?

Thanks in advance for any suggestions!

==EDIT== This is how my application is started: An install4j Launcher starts a Java class of mine, that starts a the javaws binary, which starts my main Java application.

I assume that you start web start with a "Run executable" action. Do you use System.getProperty("java.home") to get the location of the current JRE? That would yield the temporarily extracted JRE that is deleted after the installer exits.

You should use the sys.preferredJre installer variable instead. In text fields, enter ${installer:sys.preferredJre} , in scripts use context.getVariable("sys.preferredJre") . After the "Install files" action has run, the variable will contain the location of the installed JRE bundle.

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