9

I just tested my java 9 module understanding in command line. Then I moved to Intellij IDEA 2017.2.5 to test it. There I am facing the error module is not in dependencies Don't know why intellij is showing the error.

I just write required statements in module-info.java as exports and requires.

Then I use Intellij intelligence to solve the error self by IDEA. Just ALT+ENTER then I click on Add dependency on module 'module-name-here'. But I don't know what Intellij doing behind the scene. Any idea about it?

Naman
  • 27,789
  • 26
  • 218
  • 353
Asif Mushtaq
  • 3,658
  • 4
  • 44
  • 80

1 Answers1

13

But I don't know what Intellij doing behind the scene. Any idea about it?

Its adding the modules to the module path of your current module. This is very similar to adding libraries/dependencies to classpath until Java8 to use the imports.

The same can be done manually using the following steps:-

~> Project Settings 
~> Modules > Select module you want to add dependency to
~> Dependencies > Add dependency

enter image description here

Naman
  • 27,789
  • 26
  • 218
  • 353
  • How I can add manually in intellij IDEA? and also why it is not adding automatically? why it showing the error and required ALT+ENTER to solve it. – Asif Mushtaq Sep 30 '17 at 18:08
  • @UnKnown Updated the answer. – Naman Sep 30 '17 at 18:37
  • 1
    "Add dependency" means to click the "+" icon in the bottom left, select "Module Dependency" and choose the module you need to depend on. – JMess Jan 24 '18 at 21:46