Everytime I try to create a new java project Eclipse keeps asking if I want to add a module-info java file to the source folder. It's getting pretty annoying as there's no immediately obvious option to opt out of this check.
IDE for Java Developers, Photon release 4.8.0
In the Eclipse IDE, a modular Java Project can be created using the New Java Project Menu which has by default Create module-info. java option set to true. Users can specify the module name for the Java Project. They can also create/update module-info.
Yes, module-info. java was introduced in Java 9, with the Project Jigsaw module system. A module is a build artifact (usually a Jar file) that contains a module descriptor that declares the name of the module, what other modules it depends on, what packages it exposes to other modules, and what services it implements.
Starting in version 11 of Java, in Eclipse, when creating a new project, a window pops up asking whether a new “module-info. java” file should be created. It is not necessary as long as you are using Eclipse to run programs, and we suggest not creating it.
module-info. java file. It declares the dependencies within the module system and allows the compiler and the runtime to police the boundaries/access violations between the modules in your application.
See while creating a new project, after you click>> next on the very first dialog "new java project." There is one another dialog box pops up when you click >> finish. It will lead you to the 3rd dialog box which asks for the creation of module-info java file?? & gives you two option create & don't create. You should select "don't create."
Here are some advantages of the file module-info.java contents: To declare a jar file as a named module, one needs to provide a module-info.class file, which is, naturally, compiled from a module-info.java file. It declares the dependencies within the module system and allows the compiler and the runtime to police the boundaries/access violations between the modules in your application. Let’s look at the file syntax and the keywords you can use.
One great thing about the module-info.java syntax is that the modern IDEs would fully support your efforts of writing them. Perhaps all of them would work beautifully. I know that IntelliJ IDEA does content assist, quick fixes of the module files when you import classes from the module you haven’t required yet, and so on. I don’t doubt Eclipse IDE and NetBeans IDE offer the same.
Perhaps this is not a perfect solution, but it will stop asking if you choose to use Java version 8 compiler (JavaSE-1.8). If you need any newer Java version, I'm affraid don't have an answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With