Hi,
Running the command for compiling the module given in the example:
javac -d out --module-source-path src --module simpleinterest
resulted in the following directory structure:
out
└───simpleinterest
│ module-info.class
│
└───simpleinterest
└───simpleinterest
SimpleInterestCalculator.class
This means that we end up with an extra folder in our module, and the command to run this also needs to be modified accordingly.
Moreover, whenever this project is opened in an IDE, it gives an error saying that module-info.java needs to be in the src directory, not simpleinterest.
Can this be elaborated upon?
[HD Pg 0, Sec. 16.2.1 - compiling-a-module]
Moderator: admin
-
- Posts: 1
- Joined: Sun Aug 04, 2019 7:53 pm
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 0, Sec. 16.2.1 - compiling-a-module]
It is not clear from your illustration which extra folder are you refering to. Please see the folder structure that I go after compiling using the same command:
That's what the attached image shows.
Which IDE are you using?
out is the output directory. Inside out, you should have simpleinterest directory (which is the module directory for simpleinterest module) and inside out/simpleinterest you should have module-info.class That's what the attached image shows.
Which IDE are you using?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 0, Sec. 16.2.1 - compiling-a-module]
The following is the screenshot of my command line.
The generated directory structure in out is correct and the commands are correct as well.
This is the correct result. The generated directory structure in out is correct and the commands are correct as well.
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 0, Sec. 16.2.1 - compiling-a-module]
>it gives an error saying that module-info.java needs to be in the src directory, not simpleinterest.
IDE's may follow their own directory structure but as per the specification, module-info.java must be in the module directory. The module directory is simpleinterest (not src). The src folder is a source folder for all modules, not for just simpleteinterest module.
IDE's may follow their own directory structure but as per the specification, module-info.java must be in the module directory. The module directory is simpleinterest (not src). The src folder is a source folder for all modules, not for just simpleteinterest module.
Who is online
Users browsing this forum: Bing [Bot] and 7 guests