2012-06-01 32 views
0

我不知道是否有人可以幫助我,因爲我一直在堅持努力使其工作。Java applet在目錄結構中移動時未運行

有一個現有的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... 

我想我可能只是扔在一個基本代碼=「/α/β/γ/δ」,但如果我這樣做是我得到的:

basic: Added progress listener: [email protected] 

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 /斌/ DSVisApp.class)

+1

1)*「在目錄層次的頂部」*這是否意味着'在網站的根目錄?如果沒有,'codebase'可能是錯誤的前導'/'。 2)*「然後擔心切換到''」*到那時,切換到'deployJava.js',如[applet info。頁面(http://stackoverflow.com/tags/applet/info)。 3)請在發送之前檢查您的帖子,注意''將消失,除非代碼格式化 - 這是尖括號和HTML注入。 –

回答

0

感謝您的意見。

原來我做了一個毫無根據的假設(並不完全出乎意料,因爲我只知道Java在傳遞中)。我假定我給出的代碼是在服務器上運行的,記住我沒有訪問服務器的權限。

將提供的代碼導出到JAR中,並將其放入與第三方JAR相同的級別,並將JAR添加到存檔參數列表中即可立即解決問題。