5
我們的內部Java應用程序在各種時間啓動各種http URL,包括到網頁,MS Word文檔,MS Excel文檔,PDF文件等的URLAdobe Acrobat攔截Java中調用BasicService.showDocument()的每個URL
在50多臺機器上,URL啓動工作正常,並且正確的應用程序正確打開給定的頁面/文檔。然而,一個討厭的機器上安裝Adobe Acrobat試圖打開每個URL(不管目標是否爲PDF或不),並沒有(甚至在PDF文檔)有:
有一個打開此文檔出錯。文件名,目錄名稱或卷標語法不正確。
代碼發動的網址是:通話後
URL url = new URL("http://www.example.com");
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
boolean worked = bs.showDocument(url);
的worked
變量是真。
其他景點可能會有所幫助:
- 應用程序的Java Web啓動中運行。
- 運行在同一臺計算機上的小程序可以使用
AppletContext.showDocument()
- 正確打開URL。在Windows「Run ...」對話框中輸入URL可正確啓動URL。
- 我們重新安裝了JRE和Adobe Acrobat。
在此先感謝您提供的任何建議/幫助。
更新:
以下調試代碼產生以下輸出:
String[] services = ServiceManager.getServiceNames();
if(services!=null) {
for(int i=0;i<services.length;i++) {
System.out.println("Available Service: "+services[i]);
}
}
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
System.out.println(url);
System.out.println(bs);
System.out.println("bs.getCodeBase():"+bs.getCodeBase());
System.out.println("bs.isOffline():"+bs.isOffline());
System.out.println("bs.isWebBrowserSupported():"+bs.isWebBrowserSupported());
boolean worked = bs.showDocument(url);
System.out.println("bs.showDocument:"+worked);
} catch(UnavailableServiceException ue) {
System.out.println("UnavailableServiceException thrown");
ue.printStackTrace();
}
Available Service: javax.jnlp.BasicService
Available Service: javax.jnlp.FileOpenService
Available Service: javax.jnlp.FileSaveService
Available Service: javax.jnlp.DownloadService
Available Service: javax.jnlp.ClipboardService
Available Service: javax.jnlp.PersistenceService
Available Service: javax.jnlp.PrintService
Available Service: javax.jnlp.ExtendedService
Available Service: javax.jnlp.SingleInstanceService
http://<snip>
[email protected]
bs.getCodeBase():http://xxx.xxxxxx.com:8080/
bs.isOffline():false
bs.isWebBrowserSupported():true
bs.showDocument:true
謝謝。我在上面編輯了我原來的帖子......看起來好像FileOpenService存在......? – cagcowboy 2011-02-23 11:56:43