我有jsp,使用' AppletFile'来实现文件上传功能。 applet,它与java-6版本一起工作正常。 以下是整合' AppletFile'的代码。 applet到jsp:
<applet codebase="/uploadApplet" code="com.infomentum.Detect.class" id="Detect" name="Detect" width="1" height="1" viewastext mayscript></applet>
在java控制台上发生java-7及以下异常的机器上发生了问题:
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>
----------------------------------------------------
cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@46f3978d
basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@2cf590bb
security: Expected Main URL: https://iv3-manage.niit-mts.com/uploadApplet/com/infomentum/Detect.class
network: Cache entry not found [url: https://iv3-manage.niit-mts.com/uploadApplet/com/infomentum/Detect.class, version: null]
network: Connecting https://iv3-manage.niit-mts.com/uploadApplet/com/infomentum/Detect.class with proxy=DIRECT
network: Cache entry not found [url: file:/C:/Program%20Files/Java/jre7/lib/ext/sunec.jar, version: null]
network: Cache entry not found [url: file:/C:/Program%20Files/Java/jre7/lib/ext/sunjce_provider.jar, version: null]
network: Connecting http://iv3-manage.niit-mts.com:443/ with proxy=DIRECT
network: Cache entry not found [url: https://iv3-manage.niit-mts.com/uploadApplet/com/infomentum/Detect/class.class, version: null]
network: Connecting https://iv3-manage.niit-mts.com/uploadApplet/com/infomentum/Detect/class.class with proxy=DIRECT
network: Connecting http://iv3-manage.niit-mts.com:443/ with proxy=DIRECT
java.lang.ClassNotFoundException: com.infomentum.Detect.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.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
basic: load: class com.infomentum.Detect.class not found.
java.lang.ClassNotFoundException: com.infomentum.Detect.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.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@2cf590bb
security: Reset deny session certificate store
请告知这是代码问题或java-7的一些配置问题
答案 0 :(得分:1)
在Java中引用类时,只需编写其名称即可。您不必添加.class
扩展名,这只是一个技术文件系统扩展名。因此,您必须删除.class
上的code="com.infomentum.Detect.class
:
<applet codebase="/uploadApplet" code="com.infomentum.Detect" id="Detect" name="Detect" width="1" height="1" viewastext mayscript></applet>
例如,在Java类中,您将导入其他类。你会看见:
导入java.lang.Exception
而非java.lang.Exception.class
。
Java类由package
名称(类似于命名空间)和类名称标识。 .class
是多余的。