Table of Contents

Debugging executable classes in Ant or Maven projects


Prerequisites

Ant or Maven project is opened in Visual Studio. You can find instructions how to create an Ant project in this section or a Maven project in this section.

In case of Ant, the project also contains some targets to compile and pack the Java code (Javac and Jar tasks).

The code itself contains a main class (one with main method), so that it can represent a stand-alone program which can be launched in debug mode.

Actions

Configuring debug session

In this mode of debugging, an executable Java program is being launched in debug mode. There are two required parameters for such operation: the classpath (where to find JARs or classes) and the main class name. You specify both on the Debug page of the project Properties:

You can find more information on debugger options in this section.

Both required and some optional parameters have defaults which are automatically determined. The classpath is guesses based on the project, and the main class name is determined by CodeSense. Those values will likely be appropriate, otherwise just adjust them to any value you wish.

Launching debug session

When the parameters are configured, just choose Debug / Start debugging option (default key binding: F5). This is standard method of starting the debugger in Visual Studio.

Table of Contents


Copyright (C) 2014-2016 SOFT-ERG. All rights reserved.