无法加载BIRT库

时间:2013-01-31 16:21:02

标签: birt

我有一个使用BIRT的桌面应用程序。在jar文件中,我在resources的文件夹中有一个带有设计和库文件的目录。即使它们在同一个文件夹中,当我运行应用程序时,我得到一个异常,表明它无法找到rptlibrary文件:

Jan 31, 2013 11:29:33 AM org.eclipse.birt.report.model.core.LayoutModule loadLibrarySilently
WARNING: Syntax error found, and see error details.
Error.DesignFileException.SYNTAX_ERROR - 1 errors found! 
1.)  org.eclipse.birt.report.model.parser.DesignParserException (code = Error.DesignParserException.FILE_NOT_FOUND, message : The file "pdv.rptlibrary" is not found.)

如果我在rptlibrary中更改了库标签:

<list-property name="libraries">
    <structure>
        <property name="fileName">pdv.rptlibrary</property>
        <property name="namespace">pdv</property>
    </structure>
</list-property>

为:

<list-property name="libraries">
    <structure>
        <property name="fileName">modelos_relatorio/pdv.rptlibrary</property>
        <property name="namespace">pdv</property>
    </structure>
</list-property>

它可以工作,但是当我尝试在eclipse中预览时出现了一些错误,那么,有没有办法可以在代码中更改它?

1 个答案:

答案 0 :(得分:3)

您在设计器中将资源文件夹设置为什么?这可以在window-&gt;首选项中配置。 enter image description here

您可以为整个工作区或仅为特定项目配置它。如果您在应用程序中使用API​​,则应该能够在EngineConfig中设置资源路径或设置IResourceLocator接口的特定实例,这实际上只需要实现两个名为findResource的方法。您可以在源代码中查看org.eclipse.birt.report.model.util.ResourceLocatorImplBase类。