0

I just run the New Gradle project guide in Eclipse. Oddly enough it just created a Library.java and LibraryTest.java - no MyProject.java with a main-class. And even the Library.java skeleton class has a compile error¹.

This raises several questions.

  1. Below is an image of the layout of the simplest possible² Gradle project in Eclipse. Is all this really necessary for a simple command line application?

Layout of default Gradle project in Eclipse

  1. And yet (c.f. point 1) no class with a main-method is created. Why? (I assume that is expected)

  2. And finally, and most importantly, when I create a basic class with a main-method, string doesn't resolve. What's missing and is there some reason Eclipse/the New Gradle project doesn't set this up automatically?

I have found several questions here on SO with similar problem, e.g., String cannot be resolved to a type - Java RAD , but their solutions don't apply to my situation.

¹ Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor ² The highlighted class is added by me, everything else was created by the New Gradle project guide.

d-b
  • 695
  • 3
  • 14
  • 43
  • The red exclamation mark tells that your project is wrong configured. The problems message can be found in the _Problems_ view. I guess, it's something with the missing Java system library. What's the exact error message, what do you have in _Window > Preferences: Java > Installed JREs_ and which Java version is required by your project? – howlger Nov 23 '20 at 09:14
  • @howlger I added a JRE following the description here https://stackoverflow.com/a/19570719/1802826 and the problem disappeared. I am surprised that this is set to a sensible default value when following a guide like this. – d-b Nov 23 '20 at 15:14
  • This is not how you should do it. At least not for a Gradle project. Don't be surprised when following random Stack Overflow answers. Instead, please tell the information I asked for. – howlger Nov 23 '20 at 15:40

0 Answers0