JNLP 文件中的 JApplet returns 错误
JApplet in JNLP file returns error
我有一个目前可用的 Java Applet。现在我想通过 Web Start 启动这个小程序。
我有文件
Multithreading.class
test1.class
test2.class
manifest.txt
index.html
WebStart.jnlp
我用 jar cvfm WebStart.jar manifest.txt *.class
构建 jar
文件
html 文件包含:
<html lang="en-US">
<head>
<title>Web start</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<applet
alt = "Web start"
code = 'Multithreading'
jnlp_href = 'WebStart.jnlp',
width = 500,
height = 500 />
</body>
</html>
和 JNLP 文件:
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Web start</title>
<vendor>Self</vendor>
</information>
<resources>
<j2se version="1.8+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="WebStart.jar" main="true" />
</resources>
<applet-desc
name="Web start"
main-class="Multithreading"
width="500"
height="500">
</applet-desc>
<update check="background"/>
</jnlp>
我使用的java版本是java -XshowSettings:properties -version
:
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed
java.ext.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext
/usr/java/packages/lib/ext
java.home = /usr/lib/jvm/java-8-openjdk-amd64/jre
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib/amd64
/usr/lib/x86_64-linux-gnu/jni
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/jni
/lib
/usr/lib
java.runtime.name = OpenJDK Runtime Environment
java.runtime.version = 1.8.0_45-internal-b14
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_45-internal
java.vm.info = mixed mode
java.vm.name = OpenJDK 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.45-b02
line.separator = \n
os.arch = amd64
os.name = Linux
os.version = 3.19.0-26-generic
path.separator = :
sun.arch.data.model = 64
sun.boot.class.path = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sunrsasign.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfr.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/classes
所以现在当我将 html
、jnlp
和 jar
文件放入我的 /var/www/html
目录并使用 localhost/index.html
调用它时,我得到了以下错误:
Error: Unable to fetch applet instance id from Java side.
Error on Java side:
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
java.lang.NullPointerException at net.sourceforge.jnlp.NetxPanel.ourRunLoader(NetxPanel.java:117) at sun.applet.AppletViewerPanelAccess.run(AppletViewerPanelAccess.java:86) at java.lang.Thread.run(Thread.java:745)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:901)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:668)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:728)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1471)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1670)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1653)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.findClassNonRecursive(JNLPClassLoader.java:2473)
at java.security.AccessController.doPrivileged(Native Method)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2474)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2476)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.access01(JNLPClassLoader.java:2445)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.run(URLClassLoader.java:355)
at java.net.URLClassLoader.run(URLClassLoader.java:361)
at java.net.URLClassLoader.access0(URLClassLoader.java:71)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.lang.ClassLoader.defineClass1(Native Method)
Caused by: java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:927)
Exception in thread "Applet" java.lang.RuntimeException: java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access0(URLClassLoader.java:71) at java.net.URLClassLoader.run(URLClassLoader.java:361) at java.net.URLClassLoader.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.access01(JNLPClassLoader.java:2445) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2476) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2474) at java.security.AccessController.doPrivileged(Native Method) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.findClassNonRecursive(JNLPClassLoader.java:2473) at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1653) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1670) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1471) at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:728) at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:668) at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:901)
Selected proxies: [DIRECT]
Selecting proxy for: socket://localhost:80
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/Multithreading.class
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access0(URLClassLoader.java:71) at java.net.URLClassLoader.run(URLClassLoader.java:361) at java.net.URLClassLoader.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at net.sourceforge.jnlp.runtime.JNLPClassLoader.access01(JNLPClassLoader.java:103) at net.sourceforge.jnlp.runtime.JNLPClassLoader.run(JNLPClassLoader.java:1636) at net.sourceforge.jnlp.runtime.JNLPClassLoader.run(JNLPClassLoader.java:1634) at java.security.AccessController.doPrivileged(Native Method) at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1633) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1670) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1471) at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:728) at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:668) at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:901)
Class-Path attribute cleared for /home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jar
Stored action for unsigned applet at http://localhost/ was A - Always trust this (matching) applet(s)
Codebase matches codebase manifest attribute, but application is unsigned. Continuing. See: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/no_redeploy.html for details.
Trusted Only manifest attribute not found. Continuing.
Permission added: ("java.io.FilePermission" "/home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jar" "read")
Activate native: http://localhost/WebStart.jar
Activate jar: file:/home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jar
Jars not ready to provide main class
Jars not ready to provide attribute Application-Name
Jar found at /home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jarhas been verified as UNSIGNED
App already has trusted publisher: false
Jar found at /home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jarhas been verified as UNSIGNED
@ /WebStart.jar
-(DOWNLOAD)
+(DOWNLOADED)
Status: CONNECTED DOWNLOADED STARTED
@ /WebStart.jar
-(CONNECTING)
+(CONNECTED)
Status: CONNECTED DOWNLOAD STARTED
isCurrent: http://localhost/WebStart.jar = true
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jar
best url for location=http://localhost/WebStart.jar state=CONNECTING DOWNLOAD STARTED is http://localhost/WebStart.jar by HEAD
Key : Server ,Value : [Apache/2.4.10 (Ubuntu)]
Key : Accept-Ranges ,Value : [bytes]
Key : Connection ,Value : [Keep-Alive]
Key : Content-Type ,Value : [application/java-archive]
Key : Keep-Alive ,Value : [timeout=5, max=99]
Key : Last-Modified ,Value : [Wed, 02 Sep 2015 12:18:18 GMT]
Key : Content-Length ,Value : [4239]
Key : Date ,Value : [Wed, 02 Sep 2015 13:13:31 GMT]
Key : ETag ,Value : ["108f-51ec2a96a42f7"]
Key : null ,Value : [HTTP/1.1 200 OK]
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jar
All possible urls for location=http://localhost/WebStart.jar state=CONNECTING DOWNLOAD STARTED : [http://localhost/WebStart.jar, http://localhost/WebStart.jar]
@ /WebStart.jar
-(CONNECT)
+(CONNECTING)
Status: CONNECTING DOWNLOAD STARTED
@ /WebStart.jar
+(DOWNLOAD)
Status: CONNECT DOWNLOAD STARTED
@ /WebStart.jar
+(CONNECT)
Status: CONNECT STARTED
@ /WebStart.jar
+(STARTED)
Jars not ready to provide main class
Status: STARTED
Jars not ready to provide attribute Application-Name
New classloader: http://localhost/WebStart.jnlp
result: null
Jars not ready to provide main class
Jars not ready to provide attribute Application-Name
Acquired shared lock on /tmp/dan/netx/locks/netx_running to indicate javaws is running
Jars not ready to provide main class
Jars not ready to provide attribute Application-Name
UNIQUEKEY=1441199611454-1695405956-http://localhost/WebStart.jnlp
Acceptable vendor tag found, contains: Self
Acceptable title tag found, contains: Web start
Jars not ready to provide attribute Application-Name
Description: null
Homepage: null
line: 24
line: 23
line: 22
line: 21
line: 20
line: 19
line: 18 </jnlp>
line: 17 <update check="background"/>
line: 16 </applet-desc>
line: 15 height="500">
line: 14 width="500"
line: 13 main-class="Multithreading"
line: 12 name="Web start"
line: 11 <applet-desc
line: 10 </resources>
line: 9 <jar href="WebStart.jar" main="true" />
line: 8 href="http://java.sun.com/products/autodl/j2se"/>
line: 7 <j2se version="1.8+"
line: 6 <resources>
line: 5 </information>
line: 4 <vendor>Self</vendor>
line: 3 <title>Web start</title>
line: 2 <information>
<jnlp spec="1.0+" codebase="" href="">
@ /WebStart.jnlp
-(DOWNLOADING)
+(DOWNLOADED)
Status: CONNECTED DOWNLOADED STARTED
Downloadinghttp://localhost/WebStart.jnlp using http://localhost/WebStart.jnlp (encoding : null)
Selected proxies: [DIRECT]
Selecting proxy for: socket://localhost:80
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jnlp
@ /WebStart.jnlp
-(DOWNLOAD)
+(DOWNLOADING)
Status: CONNECTED DOWNLOADING STARTED
@ /WebStart.jnlp
-(CONNECTING)
+(CONNECTED)
Status: CONNECTED DOWNLOAD STARTED
isCurrent: http://localhost/WebStart.jnlp = false
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jnlp
best url for location=http://localhost/WebStart.jnlp state=CONNECTING DOWNLOAD STARTED is http://localhost/WebStart.jnlp by HEAD
Key : Server ,Value : [Apache/2.4.10 (Ubuntu)]
Key : Accept-Ranges ,Value : [bytes]
Key : Connection ,Value : [Keep-Alive]
Key : Content-Type ,Value : [application/x-java-jnlp-file]
Key : Keep-Alive ,Value : [timeout=5, max=100]
Key : Last-Modified ,Value : [Wed, 02 Sep 2015 13:07:41 GMT]
Key : Content-Length ,Value : [442]
Key : Date ,Value : [Wed, 02 Sep 2015 13:13:30 GMT]
Key : ETag ,Value : ["1ba-51ec35a097c7f"]
Key : null ,Value : [HTTP/1.1 200 OK]
Selected proxies: [DIRECT]
Selecting proxy for: socket://localhost:80
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jnlp
All possible urls for location=http://localhost/WebStart.jnlp state=CONNECTING DOWNLOAD STARTED : [http://localhost/WebStart.jnlp, http://localhost/WebStart.jnlp]
Detected online set to: true
@ /WebStart.jnlp
-(CONNECT)
+(CONNECTING)
Status: CONNECTING DOWNLOAD STARTED
@ /WebStart.jnlp
+(DOWNLOAD)
Status: CONNECT DOWNLOAD STARTED
@ /WebStart.jnlp
+(CONNECT STARTED)
Status: CONNECT STARTED
java.lang.ClassNotFoundException: java/net/URLPermission at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:191) at net.sourceforge.jnlp.SecurityDesc.<clinit>(SecurityDesc.java:164) at net.sourceforge.jnlp.JNLPFile.<init>(JNLPFile.java:137) at net.sourceforge.jnlp.PluginBridge.<init>(PluginBridge.java:90) at net.sourceforge.jnlp.PluginBridge.<init>(PluginBridge.java:67) at net.sourceforge.jnlp.NetxPanel.ourRunLoader(NetxPanel.java:101) at sun.applet.AppletViewerPanelAccess.run(AppletViewerPanelAccess.java:86) at java.lang.Thread.run(Thread.java:745)
Exception while reflectively finding URLPermission - host is probably not running Java 8+
JNLPRuntime already initialized
Using NetX panel
Read 181 entries from Firefox's preferences
Found preferences file: /home/dan/.mozilla/firefox/vq92ezur.default/prefs.js
Using firefox's profiles file: /home/dan/.mozilla/firefox/profiles.ini
Starting security dialog thread
Started processing of plugin-debug-to-console /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-debug-to-appletviewer
Starting processing of plugin-debug-to-console /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-debug-to-appletviewer
WARNING: key deployment.system.cachedir has no value, setting to default value
No User level deployment.properties found.
java.io.FileNotFoundException: /home/dan/.config/icedtea-web/deployment.properties (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:146) at java.io.FileReader.<init>(FileReader.java:72) at net.sourceforge.jnlp.config.DeploymentConfiguration.parsePropertiesFile(DeploymentConfiguration.java:655) at net.sourceforge.jnlp.config.DeploymentConfiguration.findSystemConfigFile(DeploymentConfiguration.java:479) at net.sourceforge.jnlp.config.DeploymentConfiguration.load(DeploymentConfiguration.java:292) at net.sourceforge.jnlp.config.DeploymentConfiguration.load(DeploymentConfiguration.java:262) at net.sourceforge.jnlp.runtime.JNLPRuntime$DeploymentConfigurationHolder.initConfiguration(JNLPRuntime.java:451) at net.sourceforge.jnlp.runtime.JNLPRuntime$DeploymentConfigurationHolder.<clinit>(JNLPRuntime.java:446) at net.sourceforge.jnlp.runtime.JNLPRuntime.getConfiguration(JNLPRuntime.java:481) at net.sourceforge.jnlp.config.DirectoryValidator.<init>(DirectoryValidator.java:224) at net.sourceforge.jnlp.config.DeploymentConfiguration.move14AndOlderFilesTo15Structure(DeploymentConfiguration.java:829) at net.sourceforge.jnlp.config.DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched(DeploymentConfiguration.java:733) at sun.applet.PluginMain.main(PluginMain.java:139)
cache: /home/dan/.cache/icedtea-web file exists:true
config: /home/dan/.config/icedtea-web file exists: true
System is already following XDG .cache and .config specifications
2: /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-debug-to-appletviewer
1: /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-appletviewer-to-plugin
0: /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-to-appletviewer
startup arguments:
是运行错误的javajre。 (它编译时的 java 版本比你安装在 运行s 的地方更高)
你的例外说
Multithreading : Unsupported major.minor version 52.0
52 是 Java 8 中的主要 class 版本,并且由于您已将 class Multithreading
与 Java 8 兼容,因此该版本数字有意义。
您可以使用以下方式验证这一点:
javap -verbose Multithreading | grep "major"
UnsupportedClassVersionError
通常发生在您尝试加载具有较低 Java 版本的 class 但 class 符合较高 Java 版本时.
在您的情况下,通常不会发生这种情况,因为您使用的是相同的环境。但是由于某些原因(可能与 net.sourceforge.jnlp.runtime.JNLPClassLoader
有关)您的 JRE 似乎不喜欢 52 版本。
您可以尝试以下方法:
使用较低的目标版本编译您的class:
javac -target 1.6 Multithreading.java
如果不行,尝试切换到 Oracle JDK 而不是 OpenJDK,重新编译看看是否可行。
我有一个目前可用的 Java Applet。现在我想通过 Web Start 启动这个小程序。
我有文件
Multithreading.class
test1.class
test2.class
manifest.txt
index.html
WebStart.jnlp
我用 jar cvfm WebStart.jar manifest.txt *.class
jar
文件
html 文件包含:
<html lang="en-US">
<head>
<title>Web start</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<applet
alt = "Web start"
code = 'Multithreading'
jnlp_href = 'WebStart.jnlp',
width = 500,
height = 500 />
</body>
</html>
和 JNLP 文件:
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Web start</title>
<vendor>Self</vendor>
</information>
<resources>
<j2se version="1.8+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="WebStart.jar" main="true" />
</resources>
<applet-desc
name="Web start"
main-class="Multithreading"
width="500"
height="500">
</applet-desc>
<update check="background"/>
</jnlp>
我使用的java版本是java -XshowSettings:properties -version
:
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed
java.ext.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext
/usr/java/packages/lib/ext
java.home = /usr/lib/jvm/java-8-openjdk-amd64/jre
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib/amd64
/usr/lib/x86_64-linux-gnu/jni
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/jni
/lib
/usr/lib
java.runtime.name = OpenJDK Runtime Environment
java.runtime.version = 1.8.0_45-internal-b14
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_45-internal
java.vm.info = mixed mode
java.vm.name = OpenJDK 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.45-b02
line.separator = \n
os.arch = amd64
os.name = Linux
os.version = 3.19.0-26-generic
path.separator = :
sun.arch.data.model = 64
sun.boot.class.path = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sunrsasign.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfr.jar
/usr/lib/jvm/java-8-openjdk-amd64/jre/classes
所以现在当我将 html
、jnlp
和 jar
文件放入我的 /var/www/html
目录并使用 localhost/index.html
调用它时,我得到了以下错误:
Error: Unable to fetch applet instance id from Java side.
Error on Java side:
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
java.lang.NullPointerException at net.sourceforge.jnlp.NetxPanel.ourRunLoader(NetxPanel.java:117) at sun.applet.AppletViewerPanelAccess.run(AppletViewerPanelAccess.java:86) at java.lang.Thread.run(Thread.java:745)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:901)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:668)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:728)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1471)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1670)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1653)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.findClassNonRecursive(JNLPClassLoader.java:2473)
at java.security.AccessController.doPrivileged(Native Method)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2474)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2476)
at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.access01(JNLPClassLoader.java:2445)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.run(URLClassLoader.java:355)
at java.net.URLClassLoader.run(URLClassLoader.java:361)
at java.net.URLClassLoader.access0(URLClassLoader.java:71)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.lang.ClassLoader.defineClass1(Native Method)
Caused by: java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:927)
Exception in thread "Applet" java.lang.RuntimeException: java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access0(URLClassLoader.java:71) at java.net.URLClassLoader.run(URLClassLoader.java:361) at java.net.URLClassLoader.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.access01(JNLPClassLoader.java:2445) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2476) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.run(JNLPClassLoader.java:2474) at java.security.AccessController.doPrivileged(Native Method) at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.findClassNonRecursive(JNLPClassLoader.java:2473) at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1653) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1670) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1471) at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:728) at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:668) at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:901)
Selected proxies: [DIRECT]
Selecting proxy for: socket://localhost:80
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/Multithreading.class
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
System logger called with result of 0
java.lang.UnsupportedClassVersionError: Multithreading : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access0(URLClassLoader.java:71) at java.net.URLClassLoader.run(URLClassLoader.java:361) at java.net.URLClassLoader.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at net.sourceforge.jnlp.runtime.JNLPClassLoader.access01(JNLPClassLoader.java:103) at net.sourceforge.jnlp.runtime.JNLPClassLoader.run(JNLPClassLoader.java:1636) at net.sourceforge.jnlp.runtime.JNLPClassLoader.run(JNLPClassLoader.java:1634) at java.security.AccessController.doPrivileged(Native Method) at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1633) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1670) at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1471) at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:728) at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:668) at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:901)
Class-Path attribute cleared for /home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jar
Stored action for unsigned applet at http://localhost/ was A - Always trust this (matching) applet(s)
Codebase matches codebase manifest attribute, but application is unsigned. Continuing. See: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/no_redeploy.html for details.
Trusted Only manifest attribute not found. Continuing.
Permission added: ("java.io.FilePermission" "/home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jar" "read")
Activate native: http://localhost/WebStart.jar
Activate jar: file:/home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jar
Jars not ready to provide main class
Jars not ready to provide attribute Application-Name
Jar found at /home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jarhas been verified as UNSIGNED
App already has trusted publisher: false
Jar found at /home/dan/.cache/icedtea-web/cache/21/http/localhost/WebStart.jarhas been verified as UNSIGNED
@ /WebStart.jar
-(DOWNLOAD)
+(DOWNLOADED)
Status: CONNECTED DOWNLOADED STARTED
@ /WebStart.jar
-(CONNECTING)
+(CONNECTED)
Status: CONNECTED DOWNLOAD STARTED
isCurrent: http://localhost/WebStart.jar = true
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jar
best url for location=http://localhost/WebStart.jar state=CONNECTING DOWNLOAD STARTED is http://localhost/WebStart.jar by HEAD
Key : Server ,Value : [Apache/2.4.10 (Ubuntu)]
Key : Accept-Ranges ,Value : [bytes]
Key : Connection ,Value : [Keep-Alive]
Key : Content-Type ,Value : [application/java-archive]
Key : Keep-Alive ,Value : [timeout=5, max=99]
Key : Last-Modified ,Value : [Wed, 02 Sep 2015 12:18:18 GMT]
Key : Content-Length ,Value : [4239]
Key : Date ,Value : [Wed, 02 Sep 2015 13:13:31 GMT]
Key : ETag ,Value : ["108f-51ec2a96a42f7"]
Key : null ,Value : [HTTP/1.1 200 OK]
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jar
All possible urls for location=http://localhost/WebStart.jar state=CONNECTING DOWNLOAD STARTED : [http://localhost/WebStart.jar, http://localhost/WebStart.jar]
@ /WebStart.jar
-(CONNECT)
+(CONNECTING)
Status: CONNECTING DOWNLOAD STARTED
@ /WebStart.jar
+(DOWNLOAD)
Status: CONNECT DOWNLOAD STARTED
@ /WebStart.jar
+(CONNECT)
Status: CONNECT STARTED
@ /WebStart.jar
+(STARTED)
Jars not ready to provide main class
Status: STARTED
Jars not ready to provide attribute Application-Name
New classloader: http://localhost/WebStart.jnlp
result: null
Jars not ready to provide main class
Jars not ready to provide attribute Application-Name
Acquired shared lock on /tmp/dan/netx/locks/netx_running to indicate javaws is running
Jars not ready to provide main class
Jars not ready to provide attribute Application-Name
UNIQUEKEY=1441199611454-1695405956-http://localhost/WebStart.jnlp
Acceptable vendor tag found, contains: Self
Acceptable title tag found, contains: Web start
Jars not ready to provide attribute Application-Name
Description: null
Homepage: null
line: 24
line: 23
line: 22
line: 21
line: 20
line: 19
line: 18 </jnlp>
line: 17 <update check="background"/>
line: 16 </applet-desc>
line: 15 height="500">
line: 14 width="500"
line: 13 main-class="Multithreading"
line: 12 name="Web start"
line: 11 <applet-desc
line: 10 </resources>
line: 9 <jar href="WebStart.jar" main="true" />
line: 8 href="http://java.sun.com/products/autodl/j2se"/>
line: 7 <j2se version="1.8+"
line: 6 <resources>
line: 5 </information>
line: 4 <vendor>Self</vendor>
line: 3 <title>Web start</title>
line: 2 <information>
<jnlp spec="1.0+" codebase="" href="">
@ /WebStart.jnlp
-(DOWNLOADING)
+(DOWNLOADED)
Status: CONNECTED DOWNLOADED STARTED
Downloadinghttp://localhost/WebStart.jnlp using http://localhost/WebStart.jnlp (encoding : null)
Selected proxies: [DIRECT]
Selecting proxy for: socket://localhost:80
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jnlp
@ /WebStart.jnlp
-(DOWNLOAD)
+(DOWNLOADING)
Status: CONNECTED DOWNLOADING STARTED
@ /WebStart.jnlp
-(CONNECTING)
+(CONNECTED)
Status: CONNECTED DOWNLOAD STARTED
isCurrent: http://localhost/WebStart.jnlp = false
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jnlp
best url for location=http://localhost/WebStart.jnlp state=CONNECTING DOWNLOAD STARTED is http://localhost/WebStart.jnlp by HEAD
Key : Server ,Value : [Apache/2.4.10 (Ubuntu)]
Key : Accept-Ranges ,Value : [bytes]
Key : Connection ,Value : [Keep-Alive]
Key : Content-Type ,Value : [application/x-java-jnlp-file]
Key : Keep-Alive ,Value : [timeout=5, max=100]
Key : Last-Modified ,Value : [Wed, 02 Sep 2015 13:07:41 GMT]
Key : Content-Length ,Value : [442]
Key : Date ,Value : [Wed, 02 Sep 2015 13:13:30 GMT]
Key : ETag ,Value : ["1ba-51ec35a097c7f"]
Key : null ,Value : [HTTP/1.1 200 OK]
Selected proxies: [DIRECT]
Selecting proxy for: socket://localhost:80
Selected proxies: [DIRECT]
Selecting proxy for: http://localhost/WebStart.jnlp
All possible urls for location=http://localhost/WebStart.jnlp state=CONNECTING DOWNLOAD STARTED : [http://localhost/WebStart.jnlp, http://localhost/WebStart.jnlp]
Detected online set to: true
@ /WebStart.jnlp
-(CONNECT)
+(CONNECTING)
Status: CONNECTING DOWNLOAD STARTED
@ /WebStart.jnlp
+(DOWNLOAD)
Status: CONNECT DOWNLOAD STARTED
@ /WebStart.jnlp
+(CONNECT STARTED)
Status: CONNECT STARTED
java.lang.ClassNotFoundException: java/net/URLPermission at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:191) at net.sourceforge.jnlp.SecurityDesc.<clinit>(SecurityDesc.java:164) at net.sourceforge.jnlp.JNLPFile.<init>(JNLPFile.java:137) at net.sourceforge.jnlp.PluginBridge.<init>(PluginBridge.java:90) at net.sourceforge.jnlp.PluginBridge.<init>(PluginBridge.java:67) at net.sourceforge.jnlp.NetxPanel.ourRunLoader(NetxPanel.java:101) at sun.applet.AppletViewerPanelAccess.run(AppletViewerPanelAccess.java:86) at java.lang.Thread.run(Thread.java:745)
Exception while reflectively finding URLPermission - host is probably not running Java 8+
JNLPRuntime already initialized
Using NetX panel
Read 181 entries from Firefox's preferences
Found preferences file: /home/dan/.mozilla/firefox/vq92ezur.default/prefs.js
Using firefox's profiles file: /home/dan/.mozilla/firefox/profiles.ini
Starting security dialog thread
Started processing of plugin-debug-to-console /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-debug-to-appletviewer
Starting processing of plugin-debug-to-console /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-debug-to-appletviewer
WARNING: key deployment.system.cachedir has no value, setting to default value
No User level deployment.properties found.
java.io.FileNotFoundException: /home/dan/.config/icedtea-web/deployment.properties (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:146) at java.io.FileReader.<init>(FileReader.java:72) at net.sourceforge.jnlp.config.DeploymentConfiguration.parsePropertiesFile(DeploymentConfiguration.java:655) at net.sourceforge.jnlp.config.DeploymentConfiguration.findSystemConfigFile(DeploymentConfiguration.java:479) at net.sourceforge.jnlp.config.DeploymentConfiguration.load(DeploymentConfiguration.java:292) at net.sourceforge.jnlp.config.DeploymentConfiguration.load(DeploymentConfiguration.java:262) at net.sourceforge.jnlp.runtime.JNLPRuntime$DeploymentConfigurationHolder.initConfiguration(JNLPRuntime.java:451) at net.sourceforge.jnlp.runtime.JNLPRuntime$DeploymentConfigurationHolder.<clinit>(JNLPRuntime.java:446) at net.sourceforge.jnlp.runtime.JNLPRuntime.getConfiguration(JNLPRuntime.java:481) at net.sourceforge.jnlp.config.DirectoryValidator.<init>(DirectoryValidator.java:224) at net.sourceforge.jnlp.config.DeploymentConfiguration.move14AndOlderFilesTo15Structure(DeploymentConfiguration.java:829) at net.sourceforge.jnlp.config.DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched(DeploymentConfiguration.java:733) at sun.applet.PluginMain.main(PluginMain.java:139)
cache: /home/dan/.cache/icedtea-web file exists:true
config: /home/dan/.config/icedtea-web file exists: true
System is already following XDG .cache and .config specifications
2: /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-debug-to-appletviewer
1: /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-appletviewer-to-plugin
0: /run/user/1000/icedteaplugin-dan-XkKfMv/12261-icedteanp-plugin-to-appletviewer
startup arguments:
是运行错误的javajre。 (它编译时的 java 版本比你安装在 运行s 的地方更高)
你的例外说
Multithreading : Unsupported major.minor version 52.0
52 是 Java 8 中的主要 class 版本,并且由于您已将 class Multithreading
与 Java 8 兼容,因此该版本数字有意义。
您可以使用以下方式验证这一点:
javap -verbose Multithreading | grep "major"
UnsupportedClassVersionError
通常发生在您尝试加载具有较低 Java 版本的 class 但 class 符合较高 Java 版本时.
在您的情况下,通常不会发生这种情况,因为您使用的是相同的环境。但是由于某些原因(可能与 net.sourceforge.jnlp.runtime.JNLPClassLoader
有关)您的 JRE 似乎不喜欢 52 版本。
您可以尝试以下方法:
使用较低的目标版本编译您的class:
javac -target 1.6 Multithreading.java
如果不行,尝试切换到 Oracle JDK 而不是 OpenJDK,重新编译看看是否可行。