"module com.company.sales_app"
underscore sign could be used in the module name (jls-7.7, jls-3.8)
named modules still must explicitly require the automatic module.
because the automatic module name for commons-beanutils-1.9.3.jar is not specified, then use the rules for name convertion :
name is derived from the JAR file name
the hyphens (-) will be replaced with dots (.).
the .jar suffix is removed
the version is also removed before the automatic module name
A.
We assume that all files are on the module path. That means that automatic modules are generated for all of them.
Otherwise, a named module cannot use them as a unnamed module in a requires directive.
Then, we apply the rules for name convertion.
f commons.beanutils does not have an automatic-module-name, you should use the actual JAR file name as the module name. In that case, option A would be the correct one:
A. module com.company.sales_app {
requires commons.beanutils;
requires org.apache.commons.collections4;
requires org.apache.commons.lang3;
requires org.apache.commons.text;
}
So, if commons.beanutils does not have an automatic-module-name, option A is the correct choice for modularizing the sales-app-1.1.1.jar file.
When you use a non modular jar file as an automatic module, the name of the jar file is used to formulate the module name for that module. You need to know the following two basic rules while deriving this name from the file name:
1. The dashs are converted to dots and the version information and the file extension present in the file name are ignored. Therefore, for example, the module name for commons-beanutils-1.9.jar will be commons.beanutils.
2. If the jar file's manifest contains the Automatic-Module-Name entry, then that value is used as the module name (the name of the jar file is ignored completely). Therefore, in the given problem statement, module name for commons-collections4-4.0.jar will be org.apache.commons.collections4.
A is correct. Everybody seems to disagree but the last have a module name defined. So these will be chosen. The common-beanutils does not so it's jar file name will be stripped from its version number and the '-' will be replaced by a '.'
The correct answer is B. The module-info.java file should specify the dependencies of the sales-app-1.1.jar module using the requires keyword. The names of the required modules should match the names specified by the Automatic-Module-Name entries in the manifest files of the Apache open source jar files. For example, commons-collections-4.4.2.jar specifies its module name as org.apache.commons.collections4, so the module-info.java file should include a requires org.apache.commons.collections4; statement. The commons-beanutils-1.9.3.jar file does not have an Automatic-Module-Name entry, so its module name is derived from its filename by removing the version number and replacing hyphens with dots, resulting in org.apache.commons.beanutils.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
4 weeks, 1 day agod7bb0b2
6 months, 1 week agoOmnisumem
9 months agoASPushkin
9 months agolmocanasu
9 months, 3 weeks agoaruni_mishra
10 months agoaruni_mishra
10 months ago[Removed]
10 months, 3 weeks agoStavok
1 year agoNayoumi
1 year, 1 month ago