JDK-9 won't let me use Strings: "java.lang.String is ambiguous"?
Asked Answered
N

5

9

A week ago, every project I had was working normally, but when I updated my Eclipse to the Oxygen version and installed JDK-9, things have come strange. When I try to use Strings, after some time (more like every time I save the project) the compiler throws me an error for every String in my project.


String type being recognized as an ambiguous class

String error

"The type java.lang.String is ambiguous"

So I've tried importing java.lang.String to see if it fix the error:

After the import

String error and import "The package java.lang is accessible from more than one module: java.base, java.base"

Surprise! πŸŽ‰

It doesn't :(
I've tried searching these messages on Google and SO but I found nothing...
However, the code running in JDK 8 seems to run normally, check it out:

Changing to JDK 8 (1.8.0_72)

JDK 8 fixin' it all (Code is not showing any errors before the Apply because I've applied, and open up the compiler preferences again for the screenshot)

The console error:

Error: Main method not found in class me.mateusakino.ypul.yPuLTester, please define the main method as:
public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

EDIT 1 - Main class

enter image description here

EDIT 5 - Stacktrace of the errors on Edit 4 (workspace/.metadata/.log)

!SESSION 2017-10-13 13:11:39.551 -----------------------------------------------
eclipse.buildId=4.7.1.M20171009-0410
java.version=9
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product

This is a continuation of log file C:\Users\Home\Desktop\Developer Folders\Java\Oxygen Workspace\.metadata\.bak_0.log
Created Time: 2017-10-13 13:43:14.245

!ENTRY org.eclipse.core.resources 4 75 2017-10-13 13:43:14.245
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.jdt.core 4 75 2017-10-13 13:43:14.245
!MESSAGE Errors running builder 'Java Builder' on project 'yPuL'.
!STACK 0
java.lang.NullPointerException
    at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.canAccess(ModuleBinding.java:71)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:230)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2922)
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:108)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.getTypeBinding(ArrayQualifiedTypeReference.java:93)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:495)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.internalResolveType(ArrayQualifiedTypeReference.java:107)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:586)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:582)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesWithSuspendedTempErrorHandlingPolicy(SourceTypeBinding.java:1932)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1835)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1525)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:907)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:902)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:514)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:882)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141)
    at java.base/java.lang.Thread.run(Thread.java:844)

!ENTRY org.eclipse.core.resources 4 2 2017-10-13 13:43:24.691
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException

!ENTRY org.eclipse.core.resources 4 75 2017-10-13 13:43:24.695
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.jdt.core 4 75 2017-10-13 13:43:24.695
!MESSAGE Errors running builder 'Java Builder' on project 'yPuL'.
!STACK 0
java.lang.NullPointerException

!ENTRY org.eclipse.core.resources 4 2 2017-10-13 13:43:39.104
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException

!ENTRY org.eclipse.core.resources 4 75 2017-10-13 13:43:39.110
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.jdt.core 4 75 2017-10-13 13:43:39.110
!MESSAGE Errors running builder 'Java Builder' on project 'yPuL'.
!STACK 0
java.lang.NullPointerException

!ENTRY org.eclipse.core.resources 4 2 2017-10-13 13:44:37.810
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException
    at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.canAccess(ModuleBinding.java:71)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:230)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2922)
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:108)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.getTypeBinding(ArrayQualifiedTypeReference.java:93)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:495)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.internalResolveType(ArrayQualifiedTypeReference.java:107)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:586)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:582)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesWithSuspendedTempErrorHandlingPolicy(SourceTypeBinding.java:1932)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1835)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1525)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:907)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:902)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:514)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:882)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141)
    at java.base/java.lang.Thread.run(Thread.java:844)

!ENTRY org.eclipse.core.resources 4 75 2017-10-13 13:44:37.814
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.jdt.core 4 75 2017-10-13 13:44:37.814
!MESSAGE Errors running builder 'Java Builder' on project 'yPuL'.
!STACK 0
java.lang.NullPointerException
    at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.canAccess(ModuleBinding.java:71)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:230)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2922)
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:108)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.getTypeBinding(ArrayQualifiedTypeReference.java:93)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:495)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.internalResolveType(ArrayQualifiedTypeReference.java:107)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:586)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:582)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesWithSuspendedTempErrorHandlingPolicy(SourceTypeBinding.java:1932)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1835)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1525)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:907)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:902)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:514)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:882)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141)
    at java.base/java.lang.Thread.run(Thread.java:844)

!ENTRY org.eclipse.core.resources 4 2 2017-10-13 13:44:53.701
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException
    at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.canAccess(ModuleBinding.java:71)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:230)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2922)
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:108)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.getTypeBinding(ArrayQualifiedTypeReference.java:93)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:495)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.internalResolveType(ArrayQualifiedTypeReference.java:107)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:586)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:582)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesWithSuspendedTempErrorHandlingPolicy(SourceTypeBinding.java:1932)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1835)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1525)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:907)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:902)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:514)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:882)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141)
    at java.base/java.lang.Thread.run(Thread.java:844)

!ENTRY org.eclipse.core.resources 4 75 2017-10-13 13:44:53.706
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.jdt.core 4 75 2017-10-13 13:44:53.706
!MESSAGE Errors running builder 'Java Builder' on project 'yPuL'.
!STACK 0
java.lang.NullPointerException
    at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.canAccess(ModuleBinding.java:71)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:230)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2922)
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:108)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.getTypeBinding(ArrayQualifiedTypeReference.java:93)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:495)
    at org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference.internalResolveType(ArrayQualifiedTypeReference.java:107)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:586)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:582)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesWithSuspendedTempErrorHandlingPolicy(SourceTypeBinding.java:1932)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1835)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1525)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:907)
    at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:902)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:514)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:882)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141)
    at java.base/java.lang.Thread.run(Thread.java:844)
!SESSION 2017-10-13 13:46:42.392 -----------------------------------------------
eclipse.buildId=4.7.1.M20171009-0410
java.version=9
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product

!ENTRY org.eclipse.jface 2 0 2017-10-13 13:46:49.852
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2017-10-13 13:46:49.852
!MESSAGE A conflict occurred for CTRL+TAB:
Binding(CTRL+TAB,
    ParameterizedCommand(Command(org.eclipse.ui.window.nextEditor,Next Editor,
        Switch to the next editor,
        Category(org.eclipse.ui.category.window,Window,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@5e8359da,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+TAB,
    ParameterizedCommand(Command(org.eclipse.ui.window.nextEditor,Next Editor,
        Switch to the next editor,
        Category(org.eclipse.ui.category.window,Window,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@5e8359da,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2017-10-13 13:46:49.852
!MESSAGE A conflict occurred for CTRL+SHIFT+TAB:
Binding(CTRL+SHIFT+TAB,
    ParameterizedCommand(Command(org.eclipse.ui.window.previousEditor,Previous Editor,
        Switch to the previous editor,
        Category(org.eclipse.ui.category.window,Window,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@36b6802f,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+TAB,
    ParameterizedCommand(Command(org.eclipse.ui.window.previousEditor,Previous Editor,
        Switch to the previous editor,
        Category(org.eclipse.ui.category.window,Window,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@36b6802f,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)

!ENTRY com.vaadin.designer2 1 0 2017-10-13 13:47:00.882
!MESSAGE Schedule fetching all notifications

!ENTRY com.vaadin.designer2 1 0 2017-10-13 13:47:02.845
!MESSAGE Parse notifications

!ENTRY com.vaadin.designer2 1 0 2017-10-13 13:47:03.278
!MESSAGE Requesting user info (notification settings URL)

!ENTRY com.vaadin.designer2 1 0 2017-10-13 13:47:04.704
!MESSAGE HTTP Response code :200

!ENTRY org.eclipse.egit.ui 2 0 2017-10-13 13:47:06.014
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Home'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

!ENTRY org.eclipse.dltk.core 4 0 2017-10-13 13:47:07.129
!MESSAGE Unable to find any indexer

!ENTRY org.apache.ivyde.eclipse 1 0 2017-10-13 13:48:10.554
!MESSAGE starting IvyDE plugin

!ENTRY org.apache.ivyde.eclipse 1 0 2017-10-13 13:48:10.571
!MESSAGE IvyDE plugin started

!ENTRY org.eclipse.ui 2 2 2017-10-13 13:48:12.395
!MESSAGE Invalid property category path: org.eclipse.cdt.managedbuilder.ui.properties.Page_head_build (bundle: org.eclipse.cdt.ui, propertyPage: org.eclipse.cdt.managedbuilder.ui.properties.BuildLogPreferencePage)

!ENTRY org.eclipse.jface 4 2 2017-10-13 13:48:45.611
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.IllegalArgumentException
    at org.eclipse.core.resources.ProjectScope.<init>(ProjectScope.java:58)
    at com.vaadin.designer2.eclipse.preferences.VisualDesignerPreferences.getProjectPreferences(VisualDesignerPreferences.java:680)
    at com.vaadin.designer2.eclipse.preferences.VisualDesignerPreferences.getDefaultDesigner(VisualDesignerPreferences.java:245)
    at com.vaadin.designer2.eclipse.preferences.DesignerProjectPreferencePage.createDesignerSelection(DesignerProjectPreferencePage.java:179)
    at com.vaadin.designer2.eclipse.preferences.DesignerProjectPreferencePage.createContents(DesignerProjectPreferencePage.java:109)
    at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:241)
    at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1426)
    at org.eclipse.jface.preference.PreferenceDialog$8.run(PreferenceDialog.java:1193)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:44)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
    at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1185)
    at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showPage(FilteredPreferenceDialog.java:591)
    at org.eclipse.jface.preference.PreferenceDialog$5.lambda$0(PreferenceDialog.java:657)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.jface.preference.PreferenceDialog$5.selectionChanged(PreferenceDialog.java:654)
    at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:872)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:44)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
    at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:869)
    at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1238)
    at org.eclipse.jface.viewers.StructuredViewer.lambda$0(StructuredViewer.java:1261)
    at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:81)
    at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:261)
    at org.eclipse.jface.util.OpenStrategy.access$5(OpenStrategy.java:256)
    at org.eclipse.jface.util.OpenStrategy$1.lambda$1(OpenStrategy.java:426)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4213)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3820)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
    at org.eclipse.jface.window.Window.open(Window.java:794)
    at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:157)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
    at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    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:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    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:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1472)

EDIT 7:

I could reproduce it in another workspace (Temp Workspace), and here is the .classpath file asked from @howlger:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

EDIT 8 - Eclipse report (Asked by Howlger):

https://bugs.eclipse.org/bugs/show_bug.cgi?id=526020

Details:

  • OS: Windows 10 Home (64bit)
  • JDK 9.0
  • Initial Eclipse: Oxygen Release (4.7.0) Build id: 20170620-1800
  • Current Eclipse: Oxygen.1a Release (4.7.1a) Build id: 20171005-1200
  • EDIT 4: Project settings:
  • EDIT 4: Java 9 Version: build 9+181
  • EDIT 4: Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
  • EDIT 6: All Eclipse's Plugins
  • If any other information is needed, please ask in the comment section...

What I've tried:

  • Restarting the IDE
  • Searching if there is more than one String in the Java Proposals/Completion (There was only one, java.lang's).
  • Checked the JRE System Library for more than one java.base package (There was only one, from jrt-fs.jar).
  • EDIT 2: adding modules through eclipse.ini
  • EDIT 2: updating eclipse to the version: 4.7.1a (Too many images in this post already)
  • EDIT 3: checked for double JDKs in the project and/or Eclipse preferences (Image link)
  • EDIT 4: Rebuilding java index (didn't work), enabling New Java index and rebuilding again: worked for around 3 minutes, but then this error appeared and the glitches came back again: java.lang.ClassCastException while building
  • EDIT 4: Removing JDK 9 from default library and adding it back again, the same thing from above, but this time it has thrown the error: java.lang.NullPointerException to the workspace, and the String error is still happening, even after restarting the IDE... (BTW, this warning appeared to the package keyword, not sure if it was already here before...)
Nebraska answered 13/10, 2017 at 13:30 Comment(24)
Dont you have a class named String in the same package as your main function? – Furred
I couldn't even install oxygen using JDK 9, so the safest bet would be to roll back to JDK 8. I've had multiple issues with the JDK 9, how it's going, I'm not going to install it again this year. Huge amount of random bugs. – Manatee
@Furred nope, and even if I had in any other package, Eclipse's auto-completion should show me – Nebraska
what if you change your main signature to: public static void main(java.lang.String[] args) ? – Furred
@Furred But it is already like this... Sorry I didn't show the main class, going to update a picture of it now. – Nebraska
I haven't used Eclipse for years (I'm an IntelliJ IDEA user nowadays) but it sounds like you've defined a custom JDK location in addition to a default JDK location and Eclipse thinks these two are different and thus finds that Java API classes are ambiguous. – Democrat
@Democrat The JDK is located at C:\Program Files\Java\jdk-9 (Image 3), should it be somewhere else? :( – Nebraska
I've had the same problem with java.base since updating to jdk-9. I'm thinking it's a bug in eclipse. – Marketing
@Nebraska I'm not talking about the location of the JDK on your drive (you can put it anywhere you want). I'm talking about the Eclipse dialogue boxes in which you have told Eclipse where the JDK is. Maybe there's a "Default JDK location" dialog and an "Additional Libraries" dialog and you've entered the JDK in both of those, when you should only put it in one. – Democrat
@Democrat Ok, sure... Check edit 3, probably what you're talking about... – Nebraska
Either the Java index is invalid (in Window > Preferences: Java click Rebuild Index) or the module java.base is twice in the build path of the project (check Project > Properties: Java Build Path for duplicates and try to remove and re-add JRE System Library [JavaSE-9]) – Alright
Seems like the configurations of your project are inappropriate. Could you share the complet details of your project configurations. – Kei
@nullpointer Added more information, check edit 4. If you need more details of the configurations, I may record a video showing all of them, this post is getting too long... :( – Nebraska
@Alright Seems like it worked for a bit, but then after saving my project some more times, the problem came back... check edit 4. – Nebraska
@Nebraska You will probably find stack traces of both errors in the Error Log view. Could you please add these stack traces to your question or/and report it as bug to Eclipse? – Alright
@Nebraska Obviously you have some plug-ins from Genuitec installed which can cause any kind of strange behavior (see e.g. https://mcmap.net/q/1316166/-how-to-fix-the-runtimeexception-in-genuitec-39-s-typescript-editor-for-eclipse-oxygen and https://mcmap.net/q/795990/-hiding-duplicate-toolbars-items-in-eclipse). Try to uninstall these (Angular/Webclipse?) plug-ins. – Alright
@Alright added stack (edit 5) and also all the plugins in my ide (edit 6), and I also deleted some useless UI plugins, like the darkest one (I wasn't even using lol) – Nebraska
@Gevorg I'm starting to think about it... XD – Nebraska
@nullpointer Icons and modules are resources. Here and in that case, they were doubled. I tried a couple of things to reproduce this issue with a plain Eclipse IDE (e. g. to add [JavaSE-9] to the classpath and modulepath, editing .classpath manually, etc.) but either it was not possible or an error named the correct problem. – Alright
@Nebraska There is an already fixed Eclipse bug throwing a NPE at the same location. Could you reproduce this issue with a new workspace? If yes, please show me the .classpath file of the project. – Alright
@Alright Yes I could, check edit 7. – Nebraska
@Nebraska Thanks for your effort. This looks really weird. Could you please report this issue to Eclipse with the sample project attached as ZIP and a link to your SO question here? And then tell me the bug number. I will try to reproduce it on my machine. – Alright
@Alright Done, see Edit 8 (or click here). – Nebraska
@Nebraska Thanks for reporting. Unfortunately, I was not able to reproduce this issue with the plain Eclipse IDE for Java Developers, Version: Oxygen.1a (4.7.1a): I downloaded the missing JAR, fixed the single compile error and run both projects without problems. If your Java 9 installation is not broken, I have no idea. Sorry. – Alright
R
8

In the screenshot showing all installed Eclipse plug-ins, I see something very fishy: You have two conflicting features installed:

  • Eclipse Java Development Tools - 3.13.1.v20171009-0... - good
  • Eclipse JDT (Java Development Tools) Patch with Java 9 support (BETA) for Oxygen development stream - 1.1.1.v20170826-05... - not good

From my understanding of Patch features in Eclipse, the second (older) feature could possibly override plug-ins from the former (newer) feature. This would mean still after updating to Oxygen.1a (the official release with Java 9 support) you effectively run a beta version several weeks older.

To double check, you may switch to the Plug-ins tab of the Eclipse Installation Details dialog, and search for "jdt".

This observation could easily explain, why you are still affected by bugs that have been fixed well before the release.

Solution: Please try uninstalling the Patch feature (and check back the Configuration

EDIT: More evidence can be seen in the compiler settings, compliance "9 (BETA)" is a clear indication that you are not running the release version of JDT.

Revers answered 13/10, 2017 at 21:35 Comment(3)
I'm glad it helped! I also just now added a word of warning to marketplace.eclipse.org/content/java-9-support-oxygen but I'm afraid we may not easily reach all those, that receive the release via check for updates ... :( – Revers
I've this issue with the Eclipse Oxygen.3a (4.7.3a) Build id: M20180330-0640, it has Eclipse JDT version: 3.13.4.v20180330-0919. which version I need to pick to get this fix? – Temporal
@KondalKolipaka, to positively check versions, look for the version of plug-in org.eclipse.jdt.core. In your case with Oxygen.3a it should say exactly 3.13.102.v20180330-0919. – Revers
H
2

For Java 9 support you need either:

  1. Eclipse Oxygen.1a, available from https://www.eclipse.org/downloads/eclipse-packages/

    or

  2. Manually configure your pre-Oxygen.1a Eclipse with Java 9 support, according to https://wiki.eclipse.org/Configure_Eclipse_for_Java_9

Option 1 is clearly the simpler one, as long as you have control over what version of Eclipse you install and use.

Heathenize answered 13/10, 2017 at 13:57 Comment(3)
I've tried 2nd option first, didn't work, so instead of reinstalling Eclipse, I just updated, it shouldn't make any difference at all, should it? However, still didn't work, see edit 2. – Nebraska
When I selected JDK 1.8 (image 3) it said it didn't support compliance of level 9, so probably I already have Java 9 support, maybe it's a JDK's bug instead... – Nebraska
I believe the updated question details, makes this a mere comment. As this doesn't provide a solution to the problem stated in the question anymore. – Kei
Y
0

For me the problem was solved by deleting the project from Eclipse (and deleting from disk). Then git-clone and create project and the problem was solved.

Yacketyyak answered 20/12, 2017 at 15:7 Comment(1)
Perhaps move it somewhere else on disk. Otherwise any GIT error might cause your entire project being lost :-) – Ailey
Z
0

I had same problem in Eclipse Oxygen to import the String package explicitly. The problem got solved after updating the eclipse and removing the user library used in the project.

Zephyr answered 9/5, 2018 at 22:42 Comment(0)
M
0

Idk if this helps but I ran into a similar problem: Basic classes were not recognized.

My confusion arose from the new Java convention of bundling rt.jar (and others) into an extension-less "modules" file---changing a decade-old, class-reference strategy.

Getting Eclipse to compile with JDK-10 (or JDK-9) therefore required a few things:

  1. Window->Preferences->Java->Installed JREs->Add...->Standard VM-->(Navigate to JDK-10)
  2. Window->Preferences->Java->Compiler->JDK Compliance:Compiler compliance level: 10
  3. Right-click Project->Build Path->Configure Build Path->Java Build Path->Libraries->Highlight Modulepath->Add Library->JRE System Library->Next->Select JRE 9/10 Per config->Finish

Note: #3 above is not possible unless you have performed #2 because Eclipse will not introduce the "Modulepath" option (in #3) until you have raised your Compiler compliance level (in #2).

Admittedly, this was probably obvious to most...alas, I was not most.

Mia answered 12/5, 2018 at 16:34 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.