0

我想知道是否有人可以帮助我解决这个问题,因为我一直在努力让它发挥作用。

有一个现有的 Java 小程序肯定可以工作,但我需要将它从目录层次结构顶部的当前位置移动到它内部深处的某个位置。

运行它的原始 HTML 代码是这样的:

<html>
<applet code=DSVisApp.class
archive="jcommon-1.0.16.jar,jfreechart-1.0.13.jar,
jung-graph-impl-2.0.1.jar, jung-visualization-2.0.1.jar,
gson-1.7.1.jar, jung-algorithms-2.0.1.jar, jung-api-2.0.1.jar,
collections-generic-4.01.jar,colt-1.2.0.jar" name=DSVis height=100%
width=100%>
</applet>
</html>

(我知道,我刚刚继承了它。我想让它从新位置开始工作,然后担心切换到<object>。)

结构是:

DSVisApp
 + bin
 + + DSVisApp.class
 + + and lots of other classes for this applet
 + src
 + a couple of other directories
jcommon-1.0.16.jar
and all the other jar files with support code

这适用于上面的 HTML。

现在我想把它放在几个目录级别,例如:

alpha
 + beta
 + + gamma
 + + + delta
 + + + + DSVisApp...
 + + + + jar files...

我以为我可以只输入一个 codebase="/alpha/beta/gamma/delta" 但如果我这样做,我会得到:

basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1929190

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/jcommon-1.0.16.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/jfreechart-1.0.13.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/jung-graph-impl-2.0.1.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/jung-visualization-2.0.1.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/gson-1.7.1.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/jung-algorithms-2.0.1.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/jung-api-2.0.1.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/collections-generic-4.01.jar

basic: Plugin2ClassLoader.addURL parent called for
http://disco.local/alpha/beta/gamma/delta/colt-1.2.0.jar

network: Cache entry not found [url:
http://disco.local/alpha/beta/gamma/delta/DSVisApp.class, version:
null]
network: Connecting
http://disco.local/alpha/beta/gamma/delta/DSVisApp.class with
proxy=DIRECT
network: Connecting http://disco.local:80/ with proxy=DIRECT
network: Connecting
http://disco.local/alpha/beta/gamma/delta/DSVisApp.class with cookie
"SESS59f29a0af2165ae4a0b5f5e4a22a492a=i2ds99n4hd27qoi2nida5iah67;
has_js=1"
network: Cache entry not found [url:
http://disco.local/alpha/beta/gamma/delta/DSVisApp/class.class,
version: null]
network: Connecting
http://disco.local/alpha/beta/gamma/delta/DSVisApp/class.class with
proxy=DIRECT
network: Connecting http://disco.local:80/ with proxy=DIRECT
network: Connecting
http://disco.local/alpha/beta/gamma/delta/DSVisApp/class.class with
cookie "SESS59f29a0af2165ae4a0b5f5e4a22a492a=i2ds99n4hd27qoi2nida5iah67;
has_js=1"
basic: load: class DSVisApp.class not found.
load: class DSVisApp.class not found.
java.lang.ClassNotFoundException: DSVisApp.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.createApplet(Unknown Source)
       at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown
Source)
       at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: DSVisApp.class
Ignored exception: java.lang.ClassNotFoundException: DSVisApp.class
basic: Loading Java Applet Failed...

反正我的头发不多——把它撕下来很痛。

它可能是服务器或 Java 配置的东西吗?因为很明显原始版本没有指向实际的类——实际的类在 DSVisApp/bin/DSVisApp.class)

4

2 回答 2

0

如果您将浏览器指向http://disco.local/alpha/beta/gamma/delta/DSVisApp.class,会发生什么?
如果您的服务器设置正确,系统会提示您保存 DSVisApp.class。
我猜你会得到一个404。
这表明存在 Web 服务器配置问题。

于 2012-06-01T11:24:12.713 回答
0

感谢您的建议。

原来我做了一个毫无根据的假设(并不完全出乎意料,因为我只是顺便了解 Java)。我假设给我的代码是在服务器上运行的,记住我无权访问服务器。

将提供的代码导出到 JAR 中并将其放入与第 3 方 JAR 相同的级别并将该 JAR 添加到存档参数的列表中即可立即解决问题。

于 2012-06-06T11:20:19.887 回答