Over a million developers have joined DZone.

Understanding Your Command Line Tools: Javap, Jdeps, and Jjs

DZone 's Guide to

Understanding Your Command Line Tools: Javap, Jdeps, and Jjs

When examining your code, it's helpful to have a disassembler (javap), a dependency analyzer (jdeps), and to invoke the Nashorn engine (jjs). Here's how to use them.

· Java Zone ·
Free Resource

There are several command line tools available that make a developer's job pretty easy. Still, most of us find ourselves stuck with a relative few tools at our disposal. Here, I will show you three nice command line tools and their uses.


In short, javap is a class file disassembler. A disassembler is a program that converts machine code into low-level symbolic code. Since this command disassembles the Java class file, we'll call it our Java disassembler. This command basically tells us that what is inside the class file. This command is pretty useful when we work in a restricted zone and aren't allowed to get a decompiler.

Let's see how we can use javap.

The Java file below has three methods, including the main method:

public class JavapDemo {
  static JavapDemo demo = new JavapDemo();

  public static void main(String[] args) {

  public void sayHi(){
  public void sayBye(){
  private void sayPrivateBye(){

Let's compile the above code using the javac command. Once the compilation is done, we can use the class file as an input to the javap command with various available options.

Let's use the -c option to disassemble the JavapDemo.class file:

Image title

You can see three public methods' information in the above snapshot, but private method info is not present.

To see private method info as well, you can use the -p option.

Image title


Most of the time, we keep adding JARs to our projects. Eventually, later on, it's common that a few of them are sitting idle, still going into production because there hasn't been a dependency check. In this case, jdeps is a nice tool to help with that.

This command line tool is very helpful to figure out Java class dependencies. It's known as the Java class dependency analyzer. This tool can be used with various available options.

In the example below, we'll analyze the Test.jar file at the package level:

Image title

If you want to analyze test.jar at the class level:

Image title


Jjs is a command line tool to invoke the Nashorn engine. This can be used to interpret a list of script files or to run an interactive shell.

Here we will run the below JavaScript file:


function testFunction() {
    return 5;


Now let's run the command:

Image title

Running in an interactive shell, as below:

Image title

That's all! I hope this added a nice tool or two (or three) to your kit. Enjoy!

java ,command line tools ,javap ,jdeps ,jjs ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}