在ClassNotFoundException的Java小程序使用<对象>标签 [英] ClassNotFoundException in Java Applet using <object> tag

查看:192
本文介绍了在ClassNotFoundException的Java小程序使用<对象>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的&lt嵌入Java小程序; OBJECT>标记,这是做它的XHTML严格方式

I'm trying to embed a Java Applet using the <OBJECT> tag, which is the XHTML Strict way of doing it.

浏览很多网站后,我试着这个例子这似乎工作pretty得好:

After browsing lots of sites, I tried this example which seems to work pretty well:

<!--[if !IE]> Firefox and others will use outer object -->
  <object classid="java:Sample2.class" 
          type="application/x-java-applet"
          archive="Sample2.jar" 
          height="300" width="450" >
    <!-- Konqueror browser needs the following param -->
    <param name="archive" value="Sample2.jar" />
  <!--<![endif]-->
    <!-- MSIE (Microsoft Internet Explorer) will use inner object --> 
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" 
            codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"
            height="300" width="450" > 
      <param name="code" value="Sample2" />
      <param name="archive" value="Sample2.jar" />
      <strong>
        This browser does not have a Java Plug-in.
        <br />
        <a href="http://java.sun.com/products/plugin/downloads/index.html">
          Get the latest Java Plug-in here.
        </a>
      </strong>
    </object> 
  <!--[if !IE]> close outer object -->
  </object>
  <!--<![endif]-->

我下载的Sample2.jar和完美的作品在本地主机上。

I downloaded that Sample2.jar and works perfectly on localhost.

现在,我取代Sample2.class为一个我需要使用(ar.uba.exactas.infovis.ivides.Scatterplot.class),并用自己的JAR文件(档案=piccolo.jar piccolox.jar网景。罐子scatterplot.jar):

Now, I replaced Sample2.class for the one I need to use (ar.uba.exactas.infovis.ivides.Scatterplot.class) and using my own JAR files (archive="piccolo.jar piccolox.jar netscape.jar scatterplot.jar"):

<!--[if !IE]> Firefox and others will use outer object -->
<object
    classid="java:ar.uba.exactas.infovis.ivides.Scatterplot.class"
    type="application/x-java-applet"
    archive="piccolo.jar piccolox.jar netscape.jar scatterplot.jar"
    height="300" width="450" >
    <!-- Konqueror browser needs the following param -->
    <param name="archive" value="piccolo.jar piccolox.jar netscape.jar scatterplot.jar" />
<!--<![endif]-->
    <!-- MSIE (Microsoft Internet Explorer) will use inner object -->
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    				codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"
    				height="300" width="450" >
    	<param name="code" value="ar.uba.exactas.infovis.ivides.Scatterplot" />
    	<param name="archive" value="piccolo.jar piccolox.jar netscape.jar scatterplot.jar" />
    	<strong>
    		This browser does not have a Java Plug-in.
    		<br />
    		<a href="http://java.sun.com/products/plugin/downloads/index.html">
    			Get the latest Java Plug-in here.
    		</a>
    	</strong>
    </object>
<!--[if !IE]> close outer object -->
</object>
<!--<![endif]-->

这样做之后,我想趁自己这个日志转储:

After doing so, I'm gettin this log dump:

java.lang.ClassNotFoundException: ar.uba.exactas.infovis.ivides.Scatterplot.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.IOException: open HTTP connection failed:http://localhost/infovisUBA/2008-2C/tpfinal/bin/ar/uba/exactas/infovis/ivides/Scatterplot/class.class
    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
Excepción: java.lang.ClassNotFoundException: ar.uba.exactas.infovis.ivides.Scatterplot.class

我看到的唯一区别是,我使用的是包中的类。

The only difference I see is that I'm using a class inside a package.

另外,请注意我没有使用的&lt使这项工作; APPLET>标记,但我不能以&lt使其; OBJECT>

Also, please note I did make this work using the <APPLET> tag, but I cannot make it with <OBJECT>.

任何线索?

推荐答案

好了,这是一个很难...

Well, this was a hard one...

挣扎了很多时间,但最后发现问题是戏曲本身。我使用的是alpha版本其中有这个bug。现在,它的伟大工程!

Struggled a lot of time but finally found that the problem was Opera itself. I was using an alpha version which had this bug. Now it works great!

这篇关于在ClassNotFoundException的Java小程序使用&LT;对象&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆