About Question enthuware.ocpjp.ii.v11.2.3430 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
kabanvau
Posts: 14
Joined: Thu Nov 21, 2019 5:48 am
Contact:

About Question enthuware.ocpjp.ii.v11.2.3430 :

Post by kabanvau »

Hi,

In option 1:
3. Add requires clauses for all packages contained in analytics.jar and ojdbc8.jar that are directly referred to by classes in reports.jar in its module-info.java.

But why? analytics.jar and ojdbc8.jar are automatic modules. So you have to require the two jar files in module-info.java:

requires analytics;
requires ojdbc8;

And later you can import all packages you need inside your report project. No need to require any packages in module-info.java.


Here is another example:

module-info.java

Code: Select all

module automatic {
    /* AUTOMATIC MODULE */
   /* commons-csv-1.7.jar */
    requires commons.csv;
}
Main.java

Code: Select all

package automatic.main;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import java.io.FileReader;
import java.io.IOException;
public class Main {
    public static void main(String[] args) {
        try {
            var in = new FileReader("countries.csv");
            Iterable<CSVRecord> records = CSVFormat.EXCEL.withDelimiter(';')
                    .withHeader().parse(in);
            for (CSVRecord record : records) {
                String name = record.get(1);
                System.out.println(name);
            }
            in.close();
        } catch (IOException e) {
        }
    }
}

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

Re: About Question enthuware.ocpjp.ii.v11.2.3430 :

Post by admin »

You are right. The option should just say requires clauses for the two modules not packages. Fixed.
thank you for your feedback!
Paul.
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 18 guests