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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
pavel.gurinovich
Posts: 13
Joined: Mon Nov 18, 2019 4:59 am
Contact:

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

Post 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 :)

admin
Site Admin
Posts: 10043
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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. :)
If you like our products and services, please help us by posting your review here.

wakedeer
Posts: 3
Joined: Tue Apr 21, 2020 7:04 am
Contact:

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

Post by wakedeer »

I suppose you have a typo in the explanation
javac --module-source-path src --module-path thirdpartymodulesutils.jar -d out --module modules should be thirdpartymodules/utils.jar

admin
Site Admin
Posts: 10043
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right. Fixed.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

powerofviva
Posts: 8
Joined: Tue Sep 19, 2023 12:11 pm
Contact:

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

Post by powerofviva »

last answer should be either -m or --module
-module is incorrect.

admin
Site Admin
Posts: 10043
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right. It should be --module. But it is a wrong option anyway.

thank you for your feedback
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests