我有一个小程序 jar 文件cia.jar
和其中的类,main.class
我的类在包中com.gmail.connorbphtml.WebApp
。我正在尝试将我的小程序嵌入到网页中。当我尝试这样做时,我得到一个找不到类的错误。
该小程序在 Eclipse 中运行良好,但是当我尝试嵌入它时它不起作用。
这是我使用嵌入的 HTML:
<embed code="main.class"
archive="cia.jar"
width="200" height="200"
type="application/x-java-applet;version=1.6.0"
pluginspage="http://java.sun.com/javase/downloads"/>
几个月来我一直遇到这个问题,这让我放弃了小程序,因为我无法让它工作。
有谁知道出了什么问题?
结果jar -tvf cia.jar
是:
39 Sun Sep 16 12:34:50 EDT 2012 META-INF/MANIFEST.MF
0 Sat Sep 15 18:02:30 EDT 2012 com/
0 Sat Sep 15 18:02:30 EDT 2012 com/gmail/
0 Sat Sep 15 18:02:30 EDT 2012 com/gmail/connorbphtml/
0 Sat Sep 15 18:02:30 EDT 2012 com/gmail/connorbphtml/WebApp/
136 Sat Sep 15 18:02:16 EDT 2012 com/gmail/connorbphtml/WebApp/package-info.class
692 Sat Sep 15 23:26:08 EDT 2012 com/gmail/connorbphtml/WebApp/main.class
226 Sat Sep 15 18:01:20 EDT 2012 .classpath
366 Sat Sep 15 18:01:20 EDT 2012 .project
控制台中的错误:
Java Plug-in 1.6.0_33
Using JRE version 1.6.0_33-b03-424-11M3720 Java HotSpot(TM) 64-Bit Server VM
User home directory = /Users/Connor
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
Java Plug-in 1.6.0_33
Using JRE version 1.6.0_33-b03-424-11M3720 Java HotSpot(TM) 64-Bit Server VM
User home directory = /Users/Connorload: class Sun_Microsystems_Java_Security_Update_6.class not found.
java.lang.ClassNotFoundException: Sun_Microsystems_Java_Security_Update_6.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:252)
load: class com/gmail/connorbphtml/WebApp/main.class not found.
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
load: class com/gmail/connorbphtml/WebApp/main.class not found.
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:690)
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
at java.lang.Thread.run(Thread.java:680)
Exception: java.lang.ClassNotFoundException: Sun_Microsystems_Java_Security_Update_6.class
java.lang.ClassNotFoundException: com.gmail.connorbphtml.WebApp.main.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:252)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:690)
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
at java.lang.Thread.run(Thread.java:680)
Exception: java.lang.ClassNotFoundException: com.gmail.connorbphtml.WebApp.main.class
java.lang.ClassNotFoundException: com.gmail.connorbphtml.WebApp.main.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:252)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:690)
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
at java.lang.Thread.run(Thread.java:680)
Exception: java.lang.ClassNotFoundException: com.gmail.connorbphtml.WebApp.main.class