What this tutorial is about
This tutorial aims to walk you step-by-step through debugging a Java application with Chronon.
What this tutorial is not about
Before you start...
First, it is essential to understand that Chronon is not literally a debugger - it only helps you record the execution progress and then play it back, like a videotape.
Second, make sure that:
- You are working with IntelliJ IDEA version 13.1.
- The Chronon plugin is downloaded and installed on your IntelliJ IDEA.
Preparing an example
Let’s see how Chronon works on a simple example.
First, create a project as described in the page Creating and running your first Java application.
The second is the class QuickSort.java that performs quick sorting:
And, finally, the third one is the class BubbleSort.java that performs bubble sorting:
By the way, it is recommended to type the code manually, to see the magic IntelliJ IDEA's code completion in action.
Open the Settings/Preferences dialog. To do that, click on the main toolbar, or press Ctrl+Alt+S. Under the IDE Settings, click the node Plugins.
The Chronon plugin is not bundled with IntelliJ IDEA, that's why you have to look for it in the JetBrains Plugins Repository. This is how it's done...
In the Pugins page, click the button Install JetBrains plugin... to download and install plugins from the JetBrains repository. In the Browse JetBrains Plugins dialog box, find the Chronon plugin - you can type the search string in the filter area:
Install the plugin and restart IntelliJ IDEA for the changes to take effect.
Changes to the UI
After restart, pay attention to following changes:
- Dedicated Run with Chronon icon appears on the main toolbar. By now, this icon is disabled. It will become enabled as soon as the corresponding run/debug configuration appears.
- Clicking this button opens the Chronon tool window (which also becomes available on launching the run/debug configuration).
- Chronon tab appears in the run/debug configuration of the Application type (and some other types as well).
Creating run/debug configuration
To launch our application, we need a run/debug configuration. Let's create one.
On the main menu, choose Run→Edit Configuration, and in the Run/Debug Configurations dialog box, click . We are going to create a new run/debug configuration of the Application type, so select this type:
The new run/debug configuration based on the Application type appears. So far, it is unnamed and lacks reference to the class with the main method. Let's specify the missing information.
First, give this run/debug configuration a name. Let it be ChrononDemo. Next, press Shift+Enter and find the class with the main method ChrononDemo.java. This class resides in the package demo:
Defining include/exclude patterns
Next, click the tab Chronon. In this tab, you have to specify which classes IntelliJ IDEA should look at