1.sudo apt install eclipse-platform
2.执行eclipse后报错:
!SESSION 2018-08-04 07:46:17.629 ———————————————–
eclipse.buildId=debbuild
java.version=10.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.equinox.simpleconfigurator 4 0 2018-08-04 07:46:18.098
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: The bundle “org.eclipse.equinox.simpleconfigurator_1.0.301.dist [1]” could not be resolved. Reason: Missing Constraint: Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,J2SE-1.4
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
!ENTRY org.eclipse.osgi 4 0 2018-08-04 07:46:18.103
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.simpleconfigurator_1.0.301.dist.jar was not resolved.
!ENTRY org.eclipse.osgi 2 0 2018-08-04 07:46:18.109
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2018-08-04 07:46:18.109
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.simpleconfigurator_1.0.301.dist.jar was not resolved.
!SUBENTRY 2 org.eclipse.equinox.simpleconfigurator 2 0 2018-08-04 07:46:18.110
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter=”(|(&(osgi.ee=CDC/Foundation)(version=1.1))(&(osgi.ee=JavaSE)(version=1.4)))”.
!ENTRY org.eclipse.osgi 2 0 2018-08-04 07:46:18.111
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2018-08-04 07:46:18.111
!MESSAGE Bundle org.eclipse.equinox.simpleconfigurator_1.0.301.dist [1] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.simpleconfigurator 2 0 2018-08-04 07:46:18.111
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter=”(|(&(osgi.ee=CDC/Foundation)(version=1.1))(&(osgi.ee=JavaSE)(version=1.4)))”.
!ENTRY org.eclipse.osgi 4 0 2018-08-04 07:46:18.112
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
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)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
3.菜鸟对报错无从下手,于上网上查看,搜到一位大神写的帖子:eclipse是一个java程序,运行时需要指定java虚拟机,嗷~查看eclipse目录下的eclipse.ini,还真没有指定!好像知道了什么,于是照做:
添加两行,不能放同一行:
-vm
/opt/jvm/jdk1.8.0_40/bin/java
sudo vi eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.dist.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.dist
-showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
256m
–launcher.defaultAction
openFile
-vm
/opt/jvm/jdk1.8.0_40/bin/java
-vmargs
-Xms40m
-Xmx384m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
保存,退出,重启eclipse,ok了~
附大神原文链接
********************我是分割线********************
还有一个方法,在eclipse目录下链接建立jdk的jre软连接:
ln -s /opt/jvm/jdk1.8.0_40/jre jre
然后重启eclipse,照样ok~大家可以试试