I want to launch an external JAR, which I have the path of, stored in a string called jarPath . This external JAR, has multiple dependencies in another directory called natives.
How can I, within a Java Applet, swap to this JAR (as in swap the execution of the applet code, to my external JAR's code). The main class of the external JAR, is zombie.engine.Lighting2.
For this launch I would recommend Java Web Start .
Natives are easy to deploy using JWS, as is adding other Jars to the run-time class-path. Both applets and applications ( JFrame
, JWindow
etc.) could be launched free-floating using JWS since its inception in 1.2, but from the Plug-In 2 architecture introduced in Sun's 1.6.0_10 JRE, it is possible to use JWS to deploy embedded applets.
Using this route to deploy, you would:
zombie.engine.Lighting2
as the main-class
(in the JNLP launch file). jar
elements. resources
element. The Jars with the natives as well as any other Jars referenced in the same JNLP will need to be digitally signed, and the JNLP request all-permissions
.
I want to be able to load the JAR offline, ..
See the offline-allowed
element.
offline-allowed
element: The optionaloffline-allowed
element indicates if the application can be launched offline.If offline-allowed is specified, then the application can be launched offline by the Java Application Cache Viewer, and shortcuts can be created which launch the application offline.
..from part of the information
element of the JNLP.
..I want to have a custom load screen,
JWS offers a simple GIF or JPEG based splash, but it seems like you are talking more about..
.. which incorporates custom functions for downloading the core game and logging in the user.
An installer. For installers, see the ExtensionInstallerService
. Part of the JNLP API . Other things that installers might often need are the DownloadService
/ DownloadService2
and the PersistenceService
.
您可以使用java.lang.Runtime类的exec(String命令),传递给您的命令是java -jar / path_of_your_jar_app -classpath / path_of_the_classpat_library,也许您需要。
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.