2

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

DaveCat
  • 773
  • 1
  • 10
  • 28
  • What version of Eclipse did you install? – Andreas Dec 02 '19 at 02:24
  • _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 Dec 02 '19 at 02:45
  • 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 Dec 02 '19 at 02:49
  • For Java 13 you have to install the [_Java 13 Support for Eclipse 2019-09 (4.13)_](https://marketplace.eclipse.org/content/java-13-support-eclipse-2019-09-413) plug-in, otherwise the system library (containing the _Object_ class) cannot be read. – howlger Dec 02 '19 at 07:53
  • None of these worked. – DaveCat Dec 04 '19 at 01:04

4 Answers4

10

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.

DaveCat
  • 773
  • 1
  • 10
  • 28
3

When using gradle run this:

gradlew cleanEclipse eclipse 

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

Maayan Hope
  • 1,482
  • 17
  • 32
2

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 :)
Hc.
  • 86
  • 4
  • 1
    How does this solve the problem? If you just don't use Gradle, you obviously won't get gradle errors. – DaveCat Feb 11 '20 at 14:19
  • I do not use gradle, neither my collegues, but this plugin generates a conflict with Maven and interrupt the launch. We encountered this malfunction on Eclipse 2019, june and december versions. – Hc. Feb 11 '20 at 14:28
  • 1
    Option B helped to solve the issue for me. Refer https://bugs.eclipse.org/bugs/show_bug.cgi?id=550966 for more details – amdg Aug 02 '21 at 07:51
1

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

  • This worked for me! I added this update site to Eclipse: https://download.eclipse.org/buildship/updates/e423/releases/3.x/3.1.6.v20220511-1359/ – Hugo Hernandez Apr 20 '23 at 04:41