Regarding automatic modules, they are said to be able to read every other module on the module path and/or class path without an explicit requires clause, because there is no module-info.java file.
Taken this into consideration, I think the last answer for this question is also correct and the explanation is incorrect:
"java --module-path accounting-3.3.jar;reporting-5.6.jar --module reporting/com.abc.reporting.Main
By putting reporting jar on module path, it has been converted into an automatic module (which is a named module with name reporting without any requires clause.). However, a named module cannot access a class from another named module without appropriate requries clause. Therefore, this command will not work."
About Question enthuware.ocpjp.ii.v11.2.3439 :
Moderators: Site Manager, fjwalraven
-
- Posts: 1
- Joined: Thu Jun 04, 2020 6:31 am
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3439 :
You are right. The answer and the explanation have now been fixed.
thank you for your feedback!
Paul.
thank you for your feedback!
Paul.
-
- Posts: 1
- Joined: Mon Dec 19, 2016 12:38 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3439 :
Also, I think -add-modules would fix the second option, not -add-exports.
java -classpath reporting-5.6.jar --module-path accounting-3.3.jar; com.abc.reporting.Main
java -classpath reporting-5.6.jar --module-path accounting-3.3.jar; com.abc.reporting.Main
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3439 :
You are right. Fixed.
thank you for your feedback!
thank you for your feedback!
Who is online
Users browsing this forum: Google [Bot] and 4 guests