几天前,我们决定在Eclipse RCP应用程序中开始使用Guava。我从http://central.maven.org/maven2/com/google/guava/guava/14.0.1/下载guava-14.0.1.jar。
启动eclipse.exe之后,应用程序崩溃了。 .metadata/.log文件包含以下错误:
!ENTRY org.eclipse.osgi 4 0 2013-08-12 15:56:32.033
!MESSAGE Application error
!STACK 1
java.lang.NoClassDefFoundError: com/google/common/base/Optional
at com.treeage.treeagepro.license.LicenseLevel.<clinit>(Unknown Source)
at com.treeage.treeagepro.license.LicenseInfo.<init>(Unknown Source)
at com.treeage.treeagepro.license.LicenseManager.<init>(Unknown Source)
at com.treeage.treeagepro.license.LicenseManager.getManager(Unknown Source)
at com.treeage.treeagepro.app.ApplicationWorkbenchAdvisor.initialize(Unknown Source)
at org.eclipse.ui.application.WorkbenchAdvisor.internalBasicInitialize(WorkbenchAdvisor.java:188)
at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1541)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2609)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.treeage.treeagepro.app.Application.start(Unknown Source)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
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:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Optional
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 31 more
如果应用程序以管理员身份运行,则没有错误。
该应用程序是64位的,因此这不是UAC虚拟化问题。但是看起来问题出在某种程度上与权限有关。
guava-14.0.1.jar似乎是有效的OSGi软件包:https://code.google.com/p/guava-libraries/issues/detail?id=688(至少我在MANIFEST.MF中找到了所有必要的 header )
有什么建议?
最佳答案
我通过清除C:\Users\<user_name>\.eclipse
文件夹解决了我的问题。看来问题出在某种程度上与OSGi(Equinox)临时目录有关。
关于java - Eclipse RCP应用程序仅以管理员身份启动,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18183893/