"jdeprscan jar_file" - Deprecated API of Class File

This section provides a tutorial example on how to use 'jdeprscan' command to scan for deprecated APIs of a given class file.

If you want to find out what deprecated APIs are used in a given class file, you can run the "jdeprscan class_file" command.

First, let's create a new Java program, Deprecated.java:

import java.rmi.*;
public class Deprecated {
   // deprecated in 8
   SecurityManager sm = new RMISecurityManager();

   // deprecated in 9
   Boolean b2 = new Boolean(true);

Compile it as JDK 7 the "--release 7 -Xlint:-options" options:

herong> javac --release 7 -Xlint:-options Deprecated.java

Now scan the class file for deprecated APIs:

herong> jdeprscan Deprecated.class
class Deprecated uses deprecated class java/rmi/RMISecurityManager
class Deprecated uses deprecated method java/lang/Boolean::<init>(Z)V

Cool. The "jdeprscan" did find those two statements that use deprecated APIs.

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 javadoc - The Java Document Generator

 jdeps - The Java Class Dependency Analyzer

jdeprscan - The Java Deprecated API Scanner

 jdeprscan - Deprecated API Scanner Command

"jdeprscan jar_file" - Deprecated API of Class File

 "jdeprscan jar_file" - Deprecated API of JAR File

 "jdeprscan --release X" - Deprecated API as of Release X

 "jdeprscan --list" - List All Deprecated APIs

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

 JAB (Java Access Bridge) for Windows

 Archived Tutorials


 Full Version in PDF/EPUB