Adobe Acrobat拦截从调用java中的BasicService.showDocument()的每个URL

cag*_*boy 5 java windows url acrobat

我们的内部Java应用程序在不同时间启动各种http URL,包括网页,MS Word文档,MS Excel文档,PDF文件等的URL.

在50多台机器上,URL启动工作正常,正确的应用程序正确打开给定的页面/文档.但是,在一台讨厌的机器上,Adobe Acrobat试图打开每个URL(无论目标是否是pdf),并且失败(甚至在pdf文档上):

打开此文档时出错.文件名,目录名或卷标语法不正确.

启动URL的代码是:

URL url = new URL("http://www.example.com");
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
boolean worked = bs.showDocument(url);
Run Code Online (Sandbox Code Playgroud)

worked变量调用后是真实的.

其他可能有帮助的要点:

  • 该应用程序在Java Web-Start中运行.
  • 在同一台机器上运行的applet能够正确使用打开URL AppletContext.showDocument()
  • 在Windows"运行..."对话框中输入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>
com.sun.jnlp.BasicServiceImpl@bbb8b5
bs.getCodeBase():http://xxx.xxxxxx.com:8080/
bs.isOffline():false
bs.isWebBrowserSupported():true
bs.showDocument:true
Run Code Online (Sandbox Code Playgroud)

Ber*_*ann 1

你解决这个问题了吗?如果没有,您可以尝试以下方法吗?

FileOpenService fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService"); 
Run Code Online (Sandbox Code Playgroud)