About Question enthuware.ocpjp.v11.2.3440 :
Moderator: admin
-
- Posts: 18
- Joined: Fri Feb 05, 2021 3:37 am
- Contact:
About Question enthuware.ocpjp.v11.2.3440 :
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
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
-
- Site Admin
- Posts: 10095
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
1. Correct.
2. Correct.
2. Correct.
If you like our products and services, please help us by posting your review here.
-
- Posts: 11
- Joined: Thu Sep 01, 2022 10:58 am
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
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
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
-
- Site Admin
- Posts: 10095
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
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.
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.
-
- Posts: 11
- Joined: Thu Sep 01, 2022 10:58 am
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
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.
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.
-
- Site Admin
- Posts: 10095
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
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.
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.
-
- Posts: 11
- Joined: Thu Sep 01, 2022 10:58 am
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
Ohh Already noticed! With a space between is obviusly other param :S Thanks!admin wrote: ↑Sun Aug 27, 2023 9:41 amYou 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.
-
- Posts: 12
- Joined: Sat Dec 02, 2023 12:54 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
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?
Can jdeps analyze a.jar as non-module jar? Can module jar can be run as non-module jar?
-
- Site Admin
- Posts: 10095
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
Yes, you can see the details here: https://docs.oracle.com/en/java/javase/ ... 499367ADB4
If you like our products and services, please help us by posting your review here.
-
- Posts: 12
- Joined: Fri Dec 15, 2023 4:00 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
Is it correct that the semi-colon is ignored if the space is going after it?
In this answer: jdeps --class-path lib\a.jar; lib\b.jar
In this answer: jdeps --class-path lib\a.jar; lib\b.jar
-
- Site Admin
- Posts: 10095
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3440 :
Yes, semi colon has no use here.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 8 guests