我工作的项目(在工作中)是用Java编写的,并使用Java 6.我们正在尝试迁移到OpenJDK8。我们必须使用Eclipse Indigo(它是项目的一部分)。在阅读了一些以前的线程后,我遵循了如何迁移的步骤。我遵循的步骤:
Windows -> Preferences -> Java -> Installed JRE's
。在那里,我点击了add
并选择了Java的已安装版本1.8.0
的路径。Project -> Properties -> Java Build Path -> Libraries
我选择JRE System Library
。edit
。在Alternate JRE
部分,我选择1.8.0
。然后我在打开的Java文件中收到错误(未编译或运行时错误 - 只是带有红色标记的eclipse显示):(第二步后发生错误)
Build -> External tools configuration -> JRE
部分代码:
Separate JRE
它说错误是因为1.8.0
。我已经阅读了有关该错误的所有先前的线程,但他们建议回到旧的Java版本(虽然我们想转向OpenJDK8)。我试图构建它实际上没有任何编译错误。我不确定我是否应该感到高兴或悲伤,因为我不确定我是否真的用The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
正确地构建它。总结一下,我会试着提出一些直接的问题:
final String arg = getOption(ArgNames.JOB);
if (arg.contains("~~")) {
return arg.split("~~")[1];
} else {
return arg;
}
一样有效?编辑:我点击arg.contains("~~")
重新启动Eclipse,现在当我尝试构建它时,它失败了。日志文件的第一部分如下所示:
OpenJDK8
我猜有些功能失败了。我知道qazxsw poi类在版本8中已经改变了。也许是因为它?
编辑2:从之前的主题我已经了解到Eclipse Indiago与Java 8不兼容。所以我转向了Luna。但是大多数文件现在都失败了,因为我的项目使用了Indiago。一些错误:
Java 6
如何解决这些错误?
编辑3:据我所知,Indigo不支持Java 8.所以我转向了Luna。但现在每个插件都失败了。 restart
中不存在一堆路径。该项目使用Indigo而不是Luna,因此路径不存在:
!SESSION 2019-04-18 18:45:36.356 -----------------------------------------------
eclipse.buildId=M20120208-0800
java.version=1.8.0
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -application org.eclipse.ant.core.antRunner -buildfile tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009//scripts/productBuild/productBuild.xml -Dtimestamp=2010
Command-line arguments: -application org.eclipse.ant.core.antRunner -buildfile tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009//scripts/productBuild/productBuild.xml -Dtimestamp=2010
!ENTRY org.eclipse.osgi 4 0 2019-04-18 18:45:53.567
!MESSAGE Application error
!STACK 1
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:513)
at org.eclipse.ant.core.AntRunner.start(AntRunner.java:600)
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:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009/scripts/productBuild/productBuild.xml:43: The following error occurred while executing this line:
tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009/scripts/build.xml:105: The following error occurred while executing this line:
tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009/templates/headless-build/customTargets.xml:12: The following error occurred while executing this line:
tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009/scripts/productBuild/allElements.xml:20: The following error occurred while executing this line:
tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009/scripts/genericTargets.xml:118: The following error occurred while executing this line:
tools/eclipse3.7.1-x86_64/plugins/org.eclipse.build_3.7.0.v20111116-2009/scripts/genericTargets.xml:123: The following error occurred while executing this line:
tools/workspace/buildFiles/features/org.eclipse.build.container.feature/build.xml:30: The following error occurred while executing this line:
tools/workspace/buildFiles/features/org.eclipse.build.container.feature/build.xml:16: The following error occurred while executing this line:
tools/workspace/buildFiles/features/com.feature/build.xml:278: The following error occurred while executing this line:
tools/workspace/buildFiles/features/com.feature/build.xml:109: The following error occurred while executing this line:
tools/workspace/buildFiles/plugins/com.testmanagement/build.xml:235: The following error occurred while executing this line:
tools/workspace/buildFiles/plugins/com.testmanagement/build.xml:196: Compile failed; see the compiler error output for details.
它成了一个很长的线程,我很抱歉。怎么解决?
根据您的评论,您声明您正在使用Indigo。直到Luna才引入Java 8支持,尽管Kepler可以通过补丁来支持它。 Sun
虽然这是一个博客,有人与Juno合作:The import org.eclipse cannot be resolved
The import org.osgi cannot be resolved
The import junit cannot be resolved
这是一个堆栈溢出的答案,说他们无法让它与Indigo一起工作。 Windows -> Preferences -> Plug-in Development -> Target Platform -> Running Platform -> edit