【问题标题】:what is the URL equivalent of an absolute path in non-windows system?非 Windows 系统中绝对路径的 URL 等效项是什么?
【发布时间】:2010-07-19 07:08:40
【问题描述】:

我在从 Linux 操作系统运行 BIRT 时遇到以下异常。

原因:org.eclipse.datatools.connectivity.oda.OdaException:无协议:/home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml

“/home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml”是我的 XML 数据文件。

当我查看 BIRT 中“org.eclipse.birt.report.data.oda.xml.util.XMLDataInputStreamCreator”类的代码时,我看到异常来自以下代码。

catch (MalformedURLException e)
{
  throw new OdaException(e.getLocalizedMessage());
}

这意味着代码试图将上面指定的文件路径转换为 ​​URL 并且它失败了。

所以我的问题是如何将非 Windows 路径转换为 ​​URL? 是否应该以 file:/// 为前缀?

【问题讨论】:

    标签: java xml url birt


    【解决方案1】:

    Windows 与否,所有本地文件的 URL 都以 file:// 开头。那是协议前缀。

    所以你的文件是:

    file:// + /home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml = file:///home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml

    【讨论】:

      【解决方案2】:

      您可以尝试使用文件网址:

      file:///home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml
      

      如果你能贴出代码而不是调用BIRT,那么分析问题会更容易。

      【讨论】:

        猜你喜欢
        • 2023-04-02
        • 2020-11-16
        • 1970-01-01
        • 2020-11-05
        • 2013-10-16
        • 2012-12-27
        • 1970-01-01
        • 1970-01-01
        • 2014-10-30
        相关资源
        最近更新 更多