Starten von Java-Applets direkt aus der jar-Datei
Ziel ist es, ein applet ausführen aus einer jar-Datei.
Das problem ist, dass das applet nur zu wollen scheint, ausgeführt von einem explodierten jar-Datei.
Proben auf dem Internet behaupten, dass das applet-tag:
<applet code="com.blabla.MainApplet"
archive="applet.jar"
width="600" height="600">
Diese wird nicht einmal versuchen, einen Blick in die jar-Datei und schlägt mit:
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/helloWord/com/blabbla/MainApplet.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Einstellung der Codebasis statt das Archiv-Attribut, um die jar-Datei. Sieht ein bisschen besser. Aber die JVM nicht zu erkennen, dass es zum öffnen der jar-Datei:
<applet code="com.blabla.MainApplet"
codebase="applet.jar"
width="600" height="600">
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/helloWord/applet.jar/com/blabbla/MainApplet.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Wie funktioniert das applet-tag müssen formuliert werden zu Beginn einer applet-Klasse von innen einer jar-Datei?
Du musst angemeldet sein, um einen Kommentar abzugeben.
War das problem, dass die Java-Konsole war-caching frühere schlechte Gläser. Sobald der cache gelöscht wurde im Java-Konsole, die erste version des Codes hat gut funktioniert.