罐子小程序类路径 [英] jar applet classpath
问题描述
我想一个JAR文件添加到一个简单的Java小程序可以打开有一个HTML
这是我的编码:
<小程序code =AgniCorpContactsApp.class
codeBase类=/ agnicorpcontactsWIDTH =100HEIGHT =100
归档=AgniCorpContactsApp.jar>
< /小程序>
JAR文件和所有的类文件的位置为: C:\\ Documents和Settings \\用户\\我的文档\\的NetBeansProjects \\ AgniCorpContacts \\建立\\类\\
每当我尝试运行在Internet Explorer中的文件,我得到这个错误:
载:找不到类AgniCorpContactsApp.class。
抛出java.lang.ClassNotFoundException:AgniCorpContactsApp.class
在sun.plugin2.applet.Applet2ClassLoader.findClass(来源不明)
在java.lang.ClassLoader.loadClass(来源不明)
在java.lang.ClassLoader.loadClass(来源不明)
在sun.plugin2.applet.Plugin2ClassLoader.load code(来源不明)
在sun.plugin2.applet.Plugin2Manager.createApplet(来源不明)
在sun.plugin2.applet.Plugin2Manager $ AppletExecutionRunnable.run(来源不明)
在java.lang.Thread.run(来源不明)
java.io.FileNotFoundException:引起\\ agnicorpcontacts \\ AgniCorpContactsApp \\ class.class(系统找不到指定的路径)
在java.io.FileInputStream.open(本机方法)
在java.io.FileInputStream中的<&初始化GT;(未知来源)
在java.io.FileInputStream中的<&初始化GT;(未知来源)
在sun.net.www.protocol.file.FileURLConnection.connect(来源不明)
在sun.net.www.protocol.file.FileURLConnection.getInputStream(来源不明)
在sun.plugin2.applet.Applet2ClassLoader.getBytes(来源不明)
在sun.plugin2.applet.Applet2ClassLoader.access $ 000(来源不明)
在sun.plugin2.applet.Applet2ClassLoader $ 1.run(来源不明)
在java.security.AccessController.doPrivileged(本机方法)
... 7个
异常:抛出java.lang.ClassNotFoundException:AgniCorpContactsApp.class
我需要做什么才能解决这个问题呢?是否与类路径的问题吗?
<小程序code =AgniCorpContactsApp.class>
块引用>删除
的.class
后缀。在code
必须表示完全限定类名(包括包),而不是文件名。I am trying to add a JAR file to a simple java applet which can be opened has an HTML.
This is my coding:
<applet code="AgniCorpContactsApp.class" codebase="/agnicorpcontacts" width="100" height="100" archive="AgniCorpContactsApp.jar"> </applet>
The location of the JAR file and all of the class files is:
C:\Documents and Settings\Owner\My Documents\NetBeansProjects\AgniCorpContacts\build\classes\
Whenever I try to run the file in Internet explorer I get this error:
load: class AgniCorpContactsApp.class not found. java.lang.ClassNotFoundException: AgniCorpContactsApp.class at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.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) Caused by: java.io.FileNotFoundException: \agnicorpcontacts\AgniCorpContactsApp\class.class (The system cannot find the path specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source) at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source) 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 Exception: java.lang.ClassNotFoundException: AgniCorpContactsApp.class
What do I need to do in order to fix this? Is there a problem with the class path?
解决方案<applet code="AgniCorpContactsApp.class">
Remove the
.class
suffix. Thecode
must denote the full qualified classname (including package), not the filename.这篇关于罐子小程序类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!