Category Archives: Java 11

Module Resolution

Resolve modules from the root module using the following syntax:

java --show-module-resolution -p <MODULE_PATHS> -m <ROOT_MODULE>
Identifier Description
MODULE_PATHS List of modules paths delimited by semi-colon (i.e. ;).
ROOT_MODULE The module to start the resolution.

Sample HttpClient.sendAsync() Method Usage

//Create an instance of HttpClient using its builder.
HttpClient httpClient = HttpClient.newBuilder()

//Create an instance of HttpRequest using its builder.
HttpRequest req = HttpRequest.newBuilder(URI.create(""))

/* Use the httpClient.sendAsync() method and encapsulate the response
in the CompletableFuture. */
CompletableFuture<HttpResponse> resFuture =
        httpClient.sendAsync(req, HttpResponse.BodyHandlers.ofString());

//Use the resFuture.thenAccept to wait for the async response.
resFuture.thenAccept(res -> System.out.println(res.version()));

//Wait for the resFuture to to complete.