15

I have a simple hello world project in eclipse that I want to run with java 9. The program runs when I don't have a module-info.java file but when I add that file I get the following error:

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

Steps to reproduce
1. Create a new maven project
2. Change compiler and build path jre to 9
3. Auto generate module-info.java
4. Update junit dependency in junit to 4.12 if eclipse complains
5. Run the project

Is this an eclipse related issue or am I missing something when running the project?

FYI eclipse version I use is Oxygen.1a Release (4.7.1a)

Gert Kommer
  • 1,163
  • 2
  • 22
  • 49
  • `modulefinder` is the name of the module? – Naman Nov 27 '17 at 12:49
  • @nullpointer yes it is. btw I tried do a maven install and run it from console like this `.\java.exe -cp c:\pathtojar\myjar.jar package.App` and that works. So I guess it is eclipse related? – Gert Kommer Nov 27 '17 at 12:56
  • @nullpointer Intellij works as well. I guess eclipse has still some issues with the relatively new java. – Gert Kommer Nov 27 '17 at 13:28

2 Answers2

8

Found the answer based on intellij output:) I had to add the location of the classes to the vm arguments in the run configurations as well as the module name/path to main. like below. See the java -help command for more info regarding -m and -p

enter image description here

Gert Kommer
  • 1,163
  • 2
  • 22
  • 49
  • 1
    Made [a similar answer](https://stackoverflow.com/a/47468106/1746118) pertaining to the default classpath vs modulepath execution by an IDE. Not sure if this could be a duplicate though. – Naman Nov 27 '17 at 13:59
  • 1
    @nullpointer Hey I read your answer and its looks very similar to what I have. So I agree that it is a duplicate. offtopic -> I think I'll use Intellij for now because it seems to have a bit better support for java 9 @ the moment – Gert Kommer Nov 27 '17 at 14:12
  • 1
    @nullpointer even though it is a duplicate I think it would be useful to not remove this post because this might help people who are having the same issue with this eclipse version. the other post is not specifically eclipse related. So until the issue is sort of fixed in eclipse maybe keep this question alive? – Gert Kommer Nov 27 '17 at 14:42
  • This looks like [m2e bug 525251](https://bugs.eclipse.org/bugs/show_bug.cgi?id=525251). Please add a comment to this bug with a link to your question or create a new bug report. If you like to share the launch configuration, short `-p C:\Users\gert.kommer\eclipse-workspace91java\tes2\target\classes` to `-p ${workspace_loc:tes2}/target/classes`. – howlger Jan 03 '18 at 17:02
  • 2
    FYI, other related enhancement request are: [bug 525253](https://bugs.eclipse.org/bugs/show_bug.cgi?id=525253) and [bug 520713](https://bugs.eclipse.org/bugs/show_bug.cgi?id=520713) – Stephan Herrmann Jan 04 '18 at 12:39
0

I have faced a similar kind of issue, so I have deleted the module-info.java in eclipse. It worked for me.

surya
  • 41
  • 6