Home » Software Development » What’s Cool In IntelliJIDEA. Part III: External Tools

About Anton Arhipov

Anton is JRebel Product Lead at ZeroTurnaround. Professional interests include programming laguages, middleware and tooling. Java enthusiast, vim fan, IntelliJ addict and JetBrains Academy member. He blogs at "Code Impossible" blog and speaks at Java conferences.

What’s Cool In IntelliJIDEA. Part III: External Tools

Although there is almost any kind of functionality available in IntelliJIDEA, either as a base functionality or via plugins, there’s still a fraction of probability involved that you might want to do something that goes beyond the power of the IDE. For such rare cases you might want to take a look at External Tools in IntelliJ.

Just recently I’ve encountered such a case myself – I wanted to use an utility from JDK, but in a more flexible way than just switching to command line and navigating to the correct location. My idea was that I should just press an arbitrary shortcut and get the result. So I decided to give External Tools a try.

The utility I use a lot when studying Java is javap – the java class file disassembler. This is due I study the bytecode sometimes. And although there’s ASM plugin available for IntelliJ that basically can provide me the result I needed, I still prefer to read the raw javap output.

To setup javap in Intellij as an External Tool go to Settings >> External Tools and press Add… . You can then define the location of the tool, the working directory, and the parameters.

The nice part of it is that IntelliJ provides some basic macros in order to dynamically resolve the parameters for the tool. So for javap it was enough to set $FileClass$ for the parameter, and $OutputPath$ as the working directory. And that’s it – the tool is now ready for use.

You can also define a “group” which is then used to group the external tools in the popup menu. I use “jdk” as a group name for javap so here’s what it looks after:

So that’s cool but you might have noticed that it is not that comfortable to use – have to right-click the file, navigate to “jdk” group, expand it, and only then can execute javap. Well, shortcuts to the rescue! Browse to Settings >> Keymap, and there you can define any sortcut for the tool. The nice part of it is that IntelliJ detects if you select a conflicting shortcut and notifies you.

One more tweak left to do. Once I press the shortcut that I’ve assigned to javap, the result of decompilation is printed out to the IDE console, which is just below the source code. But it would be more convenient to see it side by side. For that, it is possible to drag-and-drop the Run window to the side panel in IntelliJ so the result can be observed right next to the source I’m currently working with.

The only thing that is probably missing is the syntax highlight for the javap output, but that is probably too much to wish.

Reference: What’s Cool In IntelliJIDEA. Part III: External Tools from our JCG partner Anton Arhipov at the Code Impossible blog.

Related Articles :

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....



One comment

  1. Very informative and well written. It’s working great.
    Become your follower Anton Arhipov sir!

    Can you suggest me best way to learn bytecode how they work?

Leave a Reply

Your email address will not be published. Required fields are marked *


Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.