2

I realized a Java 9 "Hello World" program in Eclipse Version: 2020-09 (4.17.0) using the following module-info.java

module org.example.test { }

I then modified module-info.java thus changing the module name of the application:

module org.example.modified { }

When I started the application with the modified module-info.java with Run As -> Java Application I got the following error message:

Error occurred during initialization of boot layer java.lang.module.FindException: Module org.example.test not found

After displaying the command line Eclipse is using to start the application (via Run As->Run Configurations-> Show Command Line) I got the following:

C:\Program Files\Java\jdk-15.0.1\bin\javaw.exe -Dfile.encoding=Cp1252
-p "D:\Test\bin" -m org.example.test/org.example.Start

Obviously the module name has not been updated in the command line.

Any hints on how to have the command line / run configuration properly updated after a change of the module name ?

Angle.Bracket
  • 1,438
  • 13
  • 29

1 Answers1

4

Seems to be an error in Eclipse, that the Run Configuration isn't updated with the new module name.

Two workarounds:

  • Delete the Run Configuration, the do Run As > Java Application again.

    Easiest solution if you hadn't customized the Run Configuration.

  • Edit the Run Configuration:

    • Change the Main class name, e.g. add an X at the end.
    • Click Apply to save the change.
    • Click Search and select the class.
    • Click Apply to save the change.

    Seemed to work for me.

Andreas
  • 154,647
  • 11
  • 152
  • 247
  • That's not what one shall expect from an IDE though. A simple rebuild, maybe(not very hands-on of Eclipse) something like [this](https://stackoverflow.com/questions/6803322/how-to-achieve-that-eclipse-clean-and-build-aka-rebuild) would have made sense. – Naman Jan 05 '21 at 16:31
  • @Naman Do you need help providing a patch for this? – howlger Jan 05 '21 at 16:46
  • @howlger I might take a stab at it. (though honestly, I don't even prefer using eclipse for development myself), what do you say, where to start off from? and then the agreements if any might come in between as well(not really sure yet though). – Naman Jan 05 '21 at 16:47
  • I have deleted my 8s later answer. If you like, you can add the hint using Ctrl as shortcut; the first _Apply_ is not needed. – howlger Jan 05 '21 at 16:52
  • 1
    @Naman Cool! In the _Eclipse Installer_ switch to the _Advanced Mode_, on the first page choose the _Eclipse IDE for Committers_, on the second page _JDT_ and you are ready to code. – howlger Jan 05 '21 at 16:58