About Question enthuware.ocpjp.v11.2.3440 :

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

Moderator: admin

Post Reply
minajev3
Posts: 18
Joined: Fri Feb 05, 2021 3:37 am
Contact:

About Question enthuware.ocpjp.v11.2.3440 :

Post by minajev3 »

Hello! Have few questions

1) jdeps --module-path lib\a.jar; -classpath lib\b.jar app.jar
where app.jar is our final app that uses lib/a.jar
- will still not work? because a.jar as named module cant use unnamed module b.jar but it is necessary

2) jdeps --module-path lib\b.jar;lib\a.jar app.jar
// should work because b.jar is auto module now and accessible from a.jar

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

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by admin »

1. Correct.
2. Correct.
If you like our products and services, please help us by posting your review here.

Val Martinez
Posts: 11
Joined: Thu Sep 01, 2022 10:58 am
Contact:

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by Val Martinez »

Hi:

Sorry but i don't catch the difference between

Could you explain why the first works and the second not?

1 jdeps --class-path lib\a.jar; lib\b.jar
2 jdeps -cp lib\b.jar lib\a.jar

How much important are the order and the semicolon? Thanks

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

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by admin »

1 jdeps --class-path lib\a.jar; lib\b.jar
This means, you want jdeps to analyze b.jar and if does not find any class that b.jar refers to, then you are asking it to look into the jar listed in the classpath i.e. a.jar

2 jdeps -cp lib\b.jar lib\a.jar
This means, you want jdeps to analyze a.jar and if does not find any classes that a.jar refers to, then look into the jar listed in the classpath i.e. b.jar. But a.jar is a modular jar (as given in the problem statement). A modular jar is not allowed to access classes present on the classpath. So, jdeps cannot use b.jar for the analysis of a.jar.

Semi-colon is not important. It is required (on windows) only as a path separator when you are listing multiple jars or paths in the classpath.
If you like our products and services, please help us by posting your review here.

Val Martinez
Posts: 11
Joined: Thu Sep 01, 2022 10:58 am
Contact:

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by Val Martinez »

The problem for me with this kind of questions is that they are absolutely theoretical and it is quite strange that you have to work with this in a real enviroment.

Anyway, i got the key: "you can work with named modules from the classpath but not the contrary" and "jdeps starts its analysis from the rightest element". ¿Am I OK?

One more about this one:

Last option is

"jdeps -cp lib\b.jar;lib\a.jar" and the explanation says --> "A target path is required"

If semi-colon is just a separator on Windows, why the explanation is totally different to the other option

"jdeps -cp lib\b.jar lib\a.jar" where the problem was on loading non-modular jars from the module-path

???
Thank you again for your time and patience.

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

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by admin »

You need to look at the presence of space in those options.
1."jdeps -cp lib\b.jar;lib\a.jar"
In this case, lib\b.jar;lib\a.jar is the classpath that you want jdeps to use. But what is jdeps supposed to analyze? Where is the target?

2. "jdeps -cp lib\b.jar lib\a.jar"
In this case, there is a space between lib\b.jar and lib\a.jar. So you are asking jdeps to use lib\b.jar as the classpath and lib\a.jar is what you want jdeps to analyze. So that is the target.
If you like our products and services, please help us by posting your review here.

Val Martinez
Posts: 11
Joined: Thu Sep 01, 2022 10:58 am
Contact:

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by Val Martinez »

admin wrote:
Sun Aug 27, 2023 9:41 am
You need to look at the presence of space in those options.
1."jdeps -cp lib\b.jar;lib\a.jar"
In this case, lib\b.jar;lib\a.jar is the classpath that you want jdeps to use. But what is jdeps supposed to analyze? Where is the target?

2. "jdeps -cp lib\b.jar lib\a.jar"
In this case, there is a space between lib\b.jar and lib\a.jar. So you are asking jdeps to use lib\b.jar as the classpath and lib\a.jar is what you want jdeps to analyze. So that is the target.
Ohh Already noticed! With a space between is obviusly other param :S Thanks!

yulinxp
Posts: 12
Joined: Sat Dec 02, 2023 12:54 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by yulinxp »

For 4th option: jdeps -cp lib\b.jar lib\a.jar

Can jdeps analyze a.jar as non-module jar? Can module jar can be run as non-module jar?

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

Re: About Question enthuware.ocpjp.v11.2.3440 :

Post by admin »

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 27 guests