Page 1 of 1

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

Posted: Fri Jun 14, 2019 5:08 pm
by hamzaBlm
Is it possible to specify both of these options in the same javac command --module-source-path and -p(--module-path)?
Can't we just use one without using the other when compiling?

Update:
(I've read the docs) I don't understand the -m(--module) option. It says Compiles only the specified modules. Just to make sure: If we don't specify the -m option, javac will compiles all the modules found in c:\java\a and c:\java\c?

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

Posted: Fri Jun 14, 2019 9:45 pm
by admin
-p is required only if your module depends on other modules to compile.

-m option is required if you want to compile all files of the given module. If you don't specify -m, then you must list the java files that you want to compile. If you don't give -m and don't specify any java files either, then javac will give error.

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

Posted: Sat Jun 15, 2019 10:04 am
by hamzaBlm
Understood. Many Thank!

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

Posted: Wed Jul 26, 2023 9:40 am
by edufin166@yahoo.com
Hello,

The answer given was "Class files will be created under c:\java\b\x.y"

If I understood, "x.y" folder will be created under \b" folder.

So.... When we have a module with "composed-name" (such as "x.y"), a folder with "exact" same name, will be created under the ".class" files location after the compilation. I understood right?

thanks a lot

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

Posted: Thu Jul 27, 2023 12:18 am
by admin
Yes, the class files creation location (i.e. the output of javac location) is governed by -d option. In this question, it is -d c:\java\b , so the output will be created under c:\java\b. Since module name is x.y, a directory named x.y will be created under c:\java\b and class files will be created under c:\java\b\x.y (as per their package names)