2012-11-28 57 views
2

嗨,我寫一個包含小程序的Web應用程序,我使用這個標記來開始我的小應用程序的HTML頁面爲包含Applet的原因已經加載我在Java調用webproject外部庫

<applet codebase="http://localhost:8084/WebForSpark" code="AppletBroadcaster.ZkusebniApplet" archive="AppletBroadcaster.jar, jave.jar " width="500" height="500"></applet> 

我需要使用外部庫安裝插件。 jar在我的applet中,所以我將這個文件手動添加到我的Web項目的bulid/web文件夾中。所以一切運行良好。當運行我webproject Java控制檯寫這個

Basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/ with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry found [url: http://localhost:8084/WebForSpark/jave.jar, version: null] prevalidated=false/0 
cache: Resource http://localhost:8084/WebForSpark/jave.jar has expired. 
network: Connecting http://localhost:8084/WebForSpark/jave.jar with proxy=DIRECT 
network: ResponseCode for http://localhost:8084/WebForSpark/jave.jar : 304 
network: Encoding for http://localhost:8084/WebForSpark/jave.jar : null 
network: Disconnect connection to http://localhost:8084/WebForSpark/jave.jar 
cache: Reading Signers from 1048 http://localhost:8084/WebForSpark/jave.jar | C:\Users\TTT\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\3\65f57583-24e73fd0.idx 
cache: Done readSigners(http://localhost:8084/WebForSpark/jave.jar) 
cache: Read manifest for http://localhost:8084/WebForSpark/jave.jar: read=1001 full=1001 
security: Validate the certificate chain using CertPath API 
security: The certificate hasnt been expired, no need to check timestamping info 
security: Found jurisdiction list file 
security: No need to checking trusted extension for this certificate 
security: The CRL support is disabled 
security: The OCSP support is disabled 
security: This OCSP End Entity validation is disabled 
security: Checking if certificate is in Deployment denied certificate store 
security: Checking if certificate is in Deployment permanent certificate store 
security: Checking if certificate is in Deployment session certificate store 
security: Checking if certificate is in Internet Explorer TrustedPublisher certificate store 
basic: Dialog type is not candidate for embedding 

所以很明顯,jave.jar在我的生成/ Web文件夾成立。

,但是當我在我的小程序按下按鈕從jave.jar做一些操作,javaconsole寫這

network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/ with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Cache entry not found [url: http://localhost:8084/WebForSpark/lib/jave.jar, version: null] 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 
network: Connecting http://localhost:8084/WebForSpark/lib/jave.jar with proxy=DIRECT 

所有我應該做jave.jar做得正確,但我的問題是,爲什麼是如此很多時候所謂的lib/jave.jar當我jave.jar是

http://localhost:8084/WebForSpark/ 

和小程序的啓動過程中加載sucefully ...我可以沒有呼叫的lib/jave.jar做什麼和爲什麼它被稱爲?非常感謝

回答

1

目前applet元素歸結爲。

<applet 
    codebase="http://localhost:8084/WebForSpark" 
    code="AppletBroadcaster.ZkusebniApplet" 
    archive="AppletBroadcaster.jar, jave.jar" 
    width="500" 
    height="500"> 
</applet> 

這將使JRE搜索的Jar在http://localhost:8084/WebForSpark &(如若不然),其是在它從相同的路徑(或根據包子目錄)的任何類。我懷疑jave.jar實際上是另一個地方,所以archive屬性應該更像:

<applet 
    codebase="http://localhost:8084/WebForSpark" 
    code="AppletBroadcaster.ZkusebniApplet" 
    archive="AppletBroadcaster.jar, /path/to/jave.jar" 
    width="500" 
    height="500"> 
</applet> 

/path/to/可能是/lib/或其他路徑。

+0

感謝您的回覆,但我完全不瞭解你。我沒有在我的build/web文件夾中找到像lib這樣的任何文件夾或軟件包。我沒有明確告訴Java她應該搜索WebForSpark/lib/jave.jar,但是我的jave.jar位於index.html旁邊的web(CODEBASE)的根目錄中。只有在使用lib文件夾的地方在我的小程序項目中,但是在applets中它卻不是。我的心不是英語精確,所以請儘量給我寫您anothers字的意思.. –

+0

URL是從基本代碼+ Archvive組成所以在我的情況下爲http://本地主機:8084/WebForSpark + jave.jar看到我的第一個javaconsole日誌從第9行開始就有JRE如何溝通和下載jave.jar。是的,我可以在瀏覽器中使用JAVE.JAR,這對我來說是一個新的壞消息......我沒有察覺到它,這是真的很大的安全問題,我必須把我的庫放在另一個地方,用戶無法通過瀏覽器訪問它們。但在哪裏... –

+0

所以我做了一些實驗。我嘗試在myroot中創建文件夾庫,並將jar放入。將lib添加到代碼庫中會導致/WebForSpark/lib/lib/jave.jar,因此我嘗試將代碼庫設置爲僅返回到/ WebForSpark,現在它運行良好。但我不真正理解爲什麼......我的小應用程序jar被複制到代碼庫和其他jar在lib文件夾中,並且都被sucessfuly加載..在一些connfigration文件中必須記住JRE必須在codebase/lib文件夾中搜索jar,但是在哪裏。並再次 - 我可以訪問罐子inlib文件夾trouhgt瀏覽器,哪裏是罐子安全的地方? –