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 JDK internal API, called sun.reflect.Reflection.getCallerClass(). This way, we can see how jdeps helps in finding dependencies to the JDK internal APIs.
The following steps will help you to set up the prerequisites for this recipe:
- You can get the complete code for the sample from the location, chp3/1_json-jackson-sample. We have built this code against Java 9 and it compiles well. So, you need not install something ...