页面刷新后或导航到同一页面后,Applet无法重新加载,第二次获取classNotFoundException(页面刷新后)

时间:2013-02-27 07:13:53

标签: java jar applet japplet

Applet第一次加载并成功运行,但是当我们离开页面时 并再次尝试导航到同一页面,找不到类异常。

使用jnlp

exception: JNLP file error: applet-test-applet.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct..
java.io.FileNotFoundException: JNLP file error: applet-test-applet.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct.
    at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Exception: java.io.FileNotFoundException: JNLP file error: applet-test-applet.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct.

使用Jar

load: class com.*.*.uidai.auth.*.class not found.
java.lang.ClassNotFoundException: com.*.cpos.uidai.auth.*.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: 

请提供解决方案

1 个答案:

答案 0 :(得分:0)

我有同样的问题,但在我的情况下是关于从location.href捕获URL。 使用JSF时,第一次访问并没有带来真正的页面URL,但巧合的是,applet就在那里。再次单击后,将显示实际页面URL,并且找不到applet jar。 我解决了相对于基本URL的固定jar位置,而不是当前页面的位置。