Eclipse RCP - 无法在最终版本中解析导入库

时间:2015-12-18 07:57:41

标签: eclipse jar build export rcp

我尝试构建/导出Eclipse RCP产品。我有几个JAR库(不是外部JAR,但它们在项目根文件夹中)。我能够在Eclipse环境中启动应用程序/产品,但我无法将其导出为Plug-in Development / Eclipse产品。导出期间没有错误,但是当我尝试运行我的应用程序.exe文件时,会发生错误:

"An error has occurred. See the log file:
C://...configuration/123123.log"

在日志中有:

    !SESSION 2015-12-18 08:50:22.759 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_60
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=pl_PL
Command-line arguments:  -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.osgi 4 0 2015-12-18 08:50:23.284
!MESSAGE Application error
!STACK 1
java.lang.Error: Unresolved compilation problems: 
    The import com.amazonservices cannot be resolved
    MarketplaceWebServiceOrdersConfig cannot be resolved to a type
    MarketplaceWebServiceOrdersConfig cannot be resolved to a type

    at smoothflow.Application.<init>(Application.java:9)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:184)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:191)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)

!ENTRY org.eclipse.ui 4 0 2015-12-18 08:50:23.309
!MESSAGE FrameworkEvent ERROR
!STACK 0
java.lang.IllegalStateException: BundleContext is no longer valid
    at org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:983)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.removeBundleListener(BundleContextImpl.java:334)
    at org.eclipse.ui.plugin.AbstractUIPlugin$2.bundleChanged(AbstractUIPlugin.java:620)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:902)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

编辑:好的,我看到当我将项目导出到.exe时,会创建logs.zip文件。在这个日志里面有很多错误。

这些错误看起来像缺少JAR:导入XXX无法解析XXX - JAR库中的包     1.错误

C:\Users\X\workspaceRPC\SmoothFlow\src\app\amazonCalls\BaseAmazonCall.java (at line 3)
        import com.amazonservices.mws.orders._2013_09_01.MarketplaceWebServiceOrdersAsyncClient;
               ^^^^^^^^^^^^^^^^^^
    The import com.amazonservices cannot be resolved
编辑:Greg谢谢你的帮助,我在build.properties中添加了所有JAR,但问题仍然存在(相同的错误)。我的build.properties看起来像:

source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
               META-INF/,\
               .,\
               lib/,\
               lib/FastInfoset.jar,\
               lib/MWSClientJavaRuntime-1.0.jar,\
               lib/MWSOrders_2013-09-01_v2015-09-24.jar,\
               ...
jars.compile.order = .,\

1 个答案:

答案 0 :(得分:0)

除了在MANIFEST.MF中列出Jars(在编辑器的Runtime选项卡上显示)之外,您还必须在&#39; build.properties&#39;中列出jar。文件。这显示在&#39; Build&#39; MANIFEST.MF / plugin.xml / build.properties编辑器的选项卡。

一个例子:

Build properties

在这个例子中,我在&#39; lib&#39;中有三个罐子。目录中包含的目录。

build.properties文件本身如下所示:

source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               plugin.properties,\
               plugin.xml,\
               about.html,\
               about_files/,\
               lib/,\
               lib/jogg-0.0.7.jar,\
               lib/jorbis-0.0.15.jar,\
               lib/vorbisspi1.0.2.jar,\
               icons/

插件中包含的所有内容都必须列在build.properties中。