1
votes

THE PROBLEM

I've been developing in Java for years, but a recent install of my tools on a new computer (Windows 10) has resulted in the strangest problem. When I create a new project, almost everything is underlined in red. The error reads Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor:

Create Class 'Object'? Give me a break!

WHAT I TRIED:

A quick search online reveals that I should JRE System Library is most likely unbound, so I change it: Properties >> Java Build Path >> JRE System Library >> Edit:

JRE System Library

All of the red lines go away, but I can't run my program. An Error reads:

An internal error occurred during: "Launching Main". Model not available for helloWorld

On closer inspection, Eclipse shows an error in the src/test folder, but there are no files there.

When I restart Eclipse, all of the red lines reappear and I have to do everything all over again. It also cannot find the JUnit dependencies either, and I have to manually add JUnit 4 library to the build path.

DEETS YO:

OS Details: Windows 10

Eclipse Details: Version: 2019-09 R (4.13.0)

Java Details: Java 13.0.1

4
What version of Eclipse did you install?Andreas
Eclipse shows an error in the src/test folder, but there are no files there According to the image you posted, there is a file there, namely LibraryTest.java.Abra
Did you check the Problems view? Did you search the workspace log file? Did you install the plugins for gradle? You are mixing modulepath and classpath. Are you sure that is not causing a problem? Did you try using Eclipse builder instead of gradle?Abra
For Java 13 you have to install the Java 13 Support for Eclipse 2019-09 (4.13) plug-in, otherwise the system library (containing the Object class) cannot be read.howlger
None of these worked.DaveCat

4 Answers

9
votes

Alright, so none of the posted suggestions worked but I independently found out what was wrong. In general, I've found that this solves a lot of weird Gradle activity, including the ominous "Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-5.6-all.zip'" that a lot of people have problems with once they try to use Gradle with new versions of Eclipse.

Solution

When you install Eclipse, there's a Buildship Gradle Integration plug-in that is visible in the Eclipse Marketplace (it has a little graphic of an elephant next to it). When you get modern versions of JavaEE Eclipse, it comes with that installed.

The problem is that this isn't the most updated version of it.

So you have to click the button that reads "installed" and it'll update it. After you update it and restart Eclipse, your most recent version of Gradle will work.

2
votes

When using gradle run this:

gradlew cleanEclipse eclipse 

this will re-generate the eclipse project and this helped me

1
votes

Under a fresh Eclipse, we encountered this "Model not available problem" on projects that do not use Gradle, but maven. To update gradle did not change anything. We assume that there is a conflict between m2e and this plugin. We found 2 solutions :

A) Add gradle nature (even if unused)

  1. Right-click on the project
  2. Configure
  3. Add Nature (elephant logo)
  4. Run your app, enjoy

B) Uninstall gradle. (if not used and not mandatory for your eclipse version)

  1. Help/Eclipse MarketPlace
  2. Search "Gradle"
  3. Go to "BuildShop Gradle Integration 3.0" (the elephant) which is indicated as installed and clic on the grayed installed button.
  4. Uninstall it. It will restart eclipse.
  5. Run your app, enjoy :)
0
votes

In my case it is resolved by updating Buildship Gradle Integration 3.0 from Eclipse market place