Page 1 of 1

About Question enthuware.ocpjp.i.v11.2.3014 :

Posted: Fri Jun 28, 2019 9:48 am
by radupana
Hi,

The solution marked as correct says that: "This file must be present in enthu.finance directory."

However, I don't believe this is mandatory, is it?

For example, we can have a structure like:

C:\1Z0-817
└───mod1
│ module-info.java

└───by
└───boot
└───java
└───pkg
└───logger
MyLogger.java

With module-info.java containing:

Code: Select all

module by.boot.java.mod.logger {
}
In this case, module-info.java is placed in the mod1 folder even though it defines a module called by.boot.java.mod.logger (the folder name and module name are not the same).

Thanks.

Regards,
Radu

Re: About Question enthuware.ocpjp.i.v11.2.3014 :

Posted: Fri Jun 28, 2019 9:59 am
by admin
If your --module-source-path is, for example, c:\temp\modules, then your enthu.finance module must be in c:\temp\modules\enthu.finance and its module-info.java must be in c:\temp\modules\enthu.finance\

If you put the packages of this module in c:\temp\modules\someothername, then --module-source-path will not find the module enthu.finance.

Re: About Question enthuware.ocpjp.i.v11.2.3014 :

Posted: Fri Jun 28, 2019 10:18 am
by radupana
Thank you for the explanation

Re: About Question enthuware.ocpjp.i.v11.2.3014 :

Posted: Wed Feb 17, 2021 1:43 am
by radkon
admin wrote:
Fri Jun 28, 2019 9:59 am
If your --module-source-path is, for example, c:\temp\modules, then your enthu.finance module must be in c:\temp\modules\enthu.finance and its module-info.java must be in c:\temp\modules\enthu.finance\

If you put the packages of this module in c:\temp\modules\someothername, then --module-source-path will not find the module enthu.finance.
You assume that the compilation will be executed with the --module-source-path. This is not defined in the question.
You could as well be using this version of the command:

Code: Select all

javac -d someBuildPath src/module-info.java src/a/b/c/Main.java
in this case, the module name is totally decoupled from any file path.

Re: About Question enthuware.ocpjp.i.v11.2.3014 :

Posted: Wed Feb 17, 2021 5:33 am
by admin
You are right. In general, there is no restriction on where the java source file resides. However, for the purpose of the exam, in case of modules, you should assume that module-info.java resides in a directory whose name is same as the module name.
Updated the question to make it clear.
thanks for the feedback!