Page 1 of 1

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

Posted: Sat Jan 04, 2020 11:19 am
by pavel.gurinovich
I think suggestion quoted below is conceptually wrong:
You can use *.java for compiling all the files in a directory. However, writing * for a directory is incorrect. For example, the following is correct:
javac --module-source-path src -d out src/foo.bar/f/b/*.java src/foo.bar/f/c/*.java/
Since it is true only for cmd shell on Windows.

Strictly saying, program javac itself cannot consume any templates like *.java in parameters. Such templates consumed by shell (e.g. cmd or bash) and converted to list of file names which passed to javac program as parameters. For bash it is known as Pathname expansion.

So following command will work fine in bash shell:

Code: Select all

javac --module-source-path src -d out src/foo.bar/*/*/*.java
But this command will fail, since pathname expansion is disabled by singlequotes:

Code: Select all

javac --module-source-path src -d out 'src/foo.bar/f/b/*.java' 'src/foo.bar/f/c/*.java
error: file not found: src/foo.bar/f/b/*.java
Usage: javac <options> <source files>
use --help for a list of possible options


Sorry for being pedantic, as Linux user I couldn't pass it up :)

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

Posted: Sat Jan 04, 2020 12:02 pm
by admin
Thanks for sharing the information. :thumbup: Although for the purpose of the exam (and for *almost* all other practical purposes), this detail is not required. :)