Java Platform, Standard Edition Tools Reference
Total Page:16
File Type:pdf, Size:1020Kb
Java Platform, Standard Edition Tools Reference Release 9 E61612-05 October 2017 Java Platform, Standard Edition Tools Reference, Release 9 E61612-05 Copyright © 1993, 2017, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency- specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle. Contents Preface Audience vi Documentation Accessibility vi Related Documents vi Conventions vi 1 Tools and Commands Reference 2 Main Tools to Create and Build Applications javac 2-1 Annotation Processing 2-21 Searching for Types 2-22 javap 2-23 javah 2-26 javadoc 2-28 java 2-44 java Command-Line Argument Files 2-88 Enable Logging with the JVM Unified Logging Framework 2-91 Validate Java Virtual Machine Flag Arguments 2-100 Large Pages 2-100 Application Class Data Sharing 2-102 Performance Tuning Examples 2-105 Exit Status 2-106 appletviewer 2-106 AppletViewer Tags 2-107 jar 2-110 jlink 2-115 jmod 2-121 jdeps 2-126 jdeprscan 2-130 iii 3 Language Shell jshell 3-1 4 Security Tools and Commands keytool 4-1 jarsigner 4-26 policytool 4-42 kinit 4-42 klist 4-44 ktab 4-46 5 Remote Method Invocation (RMI) Tools and Commands rmic 5-1 rmiregistry 5-5 rmid 5-6 serialver 5-11 6 Java IDL and RMI-IIOP Tools and Commands tnameserv 6-1 idlj 6-6 orbd 6-12 servertool 6-16 7 Java Deployment Tools and Commands pack200 7-1 unpack200 7-5 javapackager 7-6 8 Java Web Start Tool javaws 8-1 9 Monitoring Tools and Commands jconsole 9-1 jps 9-2 jstat 9-5 iv jstatd 9-12 jmc 9-14 10 Web Services Tools and Commands schemagen 10-1 wsgen 10-2 wsimport 10-4 xjc 10-7 11 Java Accessibility Utilities and Commands jaccessinspector 11-1 jaccesswalker 11-5 12 Troubleshooting Tools and Commands jcmd 12-1 jdb 12-14 jhsdb 12-17 jinfo 12-20 jmap 12-21 jstack 12-22 13 Script Commands jjs 13-1 jrunscript 13-3 v Preface Preface The Java Platform, Standard Edition (Java SE) Command Reference describes the valid options and arguments for Java SE commands. In many cases, examples are included to show correct usage. Audience This document is intended for Java SE developers who want to use the tools and commands provided in JDK 9. Documentation Accessibility For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup? ctx=acc&id=docacc. Access to Oracle Support Oracle customers that have purchased support have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/ lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired. Related Documents For more information, see the documents in the Oracle JDK 9 Documentation Conventions The following text conventions are used in this document: Convention Meaning boldface Boldface type indicates graphical user interface elements associated with an action, or terms defined in text or the glossary. italic Italic type indicates book titles, emphasis, or placeholder variables for which you supply particular values. monospace Monospace type indicates commands within a paragraph, URLs, code in examples, text that appears on the screen, or text that you enter. vi 1 Tools and Commands Reference The JDK tools and their commands enable developers to handle development tasks such as compiling and running a program, packaging source files into a Java Archive (JAR) file, applying security policies to a JAR file, and more. The tools and commands reference topic lists and describes the Java Development Kit (JDK) tools. They’re grouped into the following sections based on the related functions that they perform. Details about the tools and the commands that you use to run them are contained in the corresponding sections of this guide. Main Tools The following foundation tools and commands let you create and build applications: • javac: You can use the javac tool and its options to read Java class and interface definitions and compile them into bytecode and class files. • javap: You use the javap command to disassemble one or more class files. • javah: You use the javah tool to generate C header and source files from a Java class. • javadoc: You use the javadoc tool and its options to generate HTML pages of API documentation from Java source files. • java: You can use the java command to launch a Java application. • appletviewer: You use the appletviewer command to launch the AppletViewer and run applets outside of a web browser. • jar: You can use the jar command to create an archive for classes and resources, and to manipulate or restore individual classes or resources from an archive. • jlink: You can use the jlink tool to assemble and optimize a set of modules and their dependencies into a custom runtime image. • jmod: You use the jmod tool to create JMOD files and list the content of existing JMOD files. • jdeps: You use the jdeps command to launch the Java class dependency analyzer. • jdeprscan: You use the jdeprscan tool as a static analysis tool that scans a jar file (or some other aggregation of class files) for uses of deprecated API elements. Language Shell The following tool gives you an interactive environment for trying out the Java language: • jshell: You use the jshell tool to interactively evaluate declarations, statements, and expressions of the Java programming language in a read-eval-print loop (REPL). 1-1 Chapter 1 Security Tools The following security tools set security policies on your system and create applications that can work within the scope of security policies set at remote sites: • keytool: You use the keytool command and options to manage a keystore (database) of cryptographic keys, X.509 certificate chains, and trusted certificates. • jarsigner: You use the jarsigner tool to sign and verify Java Archive (JAR) files. • policytool: You use policytool to read and write a plain text policy file based on user input through the utility GUI. The following tools obtain, list, and manage Kerberos tickets on Windows: • kinit: You use the kinit tool and its options to obtain and cache Kerberos ticket- granting tickets. • klist: You use the klist tool to display the entries in the local credentials cache and key table. • ktab: You use the ktab tool to manage the principal names and service keys stored in a local key table. Remote Method Invocation (RMI) Tools The following tools enable creating applications that interact over the Web or other network: • rmic: You use the rmic compiler to generate stub and skeleton class files using the Java Remote Method Protocol (JRMP) and stub and tie class files (IIOP protocol) for remote objects.