简体   繁体   English

即使可以在其他地方访问类,也可以使用java.lang.ClassNotFoundException

[英]java.lang.ClassNotFoundException even though class can be accessed in other places

I'm running a Java Applet on a Python-CGI server and it's giving a java.lang.ClassNotFoundException from my JNLP file in both Google Chrome and Internet Explorer. 我正在Python-CGI服务器上运行Java Applet,它从Google Chrome和Internet Explorer的JNLP文件中给出了java.lang.ClassNotFoundException。 On loading the HTML files (for Google Chrome and IE), however, I get a 200 request from my .class file and I've referenced the .class file in my HTML files and my JNLP file the same way and their in the same directory ( classes.Template ). 但是,在加载HTML文件(适用于Google Chrome和IE)时,我从我的.class文件中收到了200个请求,并且以相同的方式和相同的方式在HTML文件和JNLP文件中引用了.class文件目录( classes.Template )。 I did some research, but couldn't find anything that helped me. 我做了一些研究,但找不到任何对我有帮助的东西。

Files: 档案:

localhost:8070/Java%20Applets/Template: /classes, /Applet.jar, /Display.html, /IE.html, /info.jnlp, /manifest.txt 本地主机:8070 / Java%20Applets /模板:/classes、/Applet.jar、/Display.html、/IE.html、/info.jnlp、/manifest.txt

localhost:8070/Java%20Applets/Template/classes: /Template.class, /Template.java 本地主机:8070 / Java%20Applets / Template / classes:/Template.class、/Template.java

http://devdoodle.net/dev/152/ http://devdoodle.net/dev/152/

Error message: 错误信息:

http://devdoodle.net/dev/153/ http://devdoodle.net/dev/153/

You need to set the href attribute of the JNLP file so it can find the class file: 您需要设置JNLP文件的href属性,以便它可以找到类文件:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec "1.0+" codebase="http://localhost:8070/Java%20Applets/Template/" href="info.jnlp">
    <information>
        <title>Applet Template</title>
        <vendor>Noble H. Mushtak</vendor>
    </information>
    <resources>
         <j2se version = "1.7+" href = "http://java.sun.com/products/autodl/j2se"/>
         <jar href = "Applet.jar" main = "true"/>
    </resources>
    <applet-desc name = "Java Applet Template" main-class = "classes/Template.class" width = "100" height = "100"/>
</jnlp>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM