Book Image

Java 9 Cookbook

By : Mohamed Sanaulla, Nick Samoylov
Book Image

Java 9 Cookbook

By: Mohamed Sanaulla, Nick Samoylov

Overview of this book

<p>Java is an object-oriented programming language. It is one of the most widely accepted languages because of its design and programming features, particularly in its promise that you can write a program once and run it anywhere.</p> <p>This cookbook offers a range of software development examples in simple and straightforward Java 9 code, providing step-by-step resources and time-saving methods to help you solve data problems efficiently. Starting with the installation of Java, each recipe addresses a specific problem, with a discussion that explains the solution and offers insight into how it works.</p> <p>We cover major concepts such as Project Jigsaw and various tools that will enable you to modularize your applications. You will learn new features in the form of recipes that will make your applications modular, secure, and fast.</p>
Table of Contents (22 chapters)
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Using jdeps to find dependencies in a Java application


The first step in modularizing your application is to identify its dependencies. A static analysis tool called jdeps was introduced in JDK 8 to enable developers to find the dependencies of their applications. There are multiple options supported in the command, which enables developers to check for dependencies to the JDK internal APIs, show the dependencies at the package level, show the dependencies at the class level, and filter the dependencies, among other options. 

In this recipe, we will look at how to make use of the jdeps tool by exploring its functionality and using the multiple command-line options it supports. 

Getting ready

We need a sample application, which we can run against the jdeps command to find its dependencies. So, we thought of creating a very simple application that uses the Jackson API to consume JSON from the REST API: http://jsonplaceholder.typicode.com/users.

In the sample code, we also added a call to the deprecated...