Important Java command line commands
In this tutorial we are going to explain and show important Java commands. These commands enable developers to handle development tasks such as compiling and running the program.
These commands are grouped in several sections based on the related functions that they perform. Details about the tools and the commands that you use to run them are described in the corresponding sections.
There are several other tool groups, but describing each and every one of them would be out of scope of this tutorial. However, we will briefly mention them at the end of this tutorial.
Note: This codes and explanations are written by example from Oracle site.
Firstly here are some of the commands that you get when you type "java" in terminal/cmd:
1. Main Tools
This type of tools will let you create and build applications:
- java - we can use this command to launch a Java application.
- javac - we can use this tool to read Java class and interface definitions and compile them into bytecode and class files
- javap - we can use this command to disassemble one or more class files
- jmod - we can use this command to create JMOD files and list the content of existing JMOD files
- javadoc - we can use this command to generate HTML pages of API documentation from Java source files
- java -version - we can use this command to check java version
2. Security Tools
This type will set security policies on your system and create applications that can work within the scope of security policies set at remote sites:
- keytool - we can use this command to manage a keystore (database) of cryptographic keys
- jarsigner - we can use this tool to sign and verify Java Archive (JAR) files
- policytool - we can use this command to read and write a plain text policy file based on user input through the utility GUI
3. Monitoring Tools
The following tools will let you monitor performance statistics:
- jconsole - we can use this command to start a graphical console to monitor and manage Java applications
- jps - we can use this command to list the instrumented JVMs on the target systems
- jstat - we can use this command to monitor JVM statistics. Note: this is experimental
- jmc - we can use this command to launch Java Mission Control. JMS is a profiling monitoring and diagnostics tools suite
Last but not least we will mention other groups of tools for handling development tasks in Java:
- Language Shell (gives and interactive environment for trying out the Java language)
- Remote Method Invocation (RMI) Tools (enables creating applications that interact over the Web or other network)
- Java Deployment Tools (this lets you deploy Java applications and applets on the Web)
- Java Web Start (this utility launches Java Web Start applications)
- Troubleshooting Tools (this tools let you perform specific troubleshooting tasks)