Debugging Java Applications on HPE Nonstop Using Visual Studio Code

Version: 0.1

Debugging Java on HPE Nonstop

Table of Contents

Introduction

Client-side Setup

VS Code configuration

Debugging standalone java application

Debugging an application running in Pathway environment

Conclusion

Introduction

Visual Studio Code (VS Code) is a lightweight, extensible source code editor developed by Microsoft. It provides a powerful environment for coding, building, and debugging applications across multiple programming languages.

This document outlines the steps required to debug Java applications running on HPE Nonstop systems using VS Code (GUI). It includes instructions for vs code installation, configuration, and client-side setup to ensure a smooth debugging experience.

Client-side Setup

Install Visual Studio Code and configure it with the necessary extensions for Java development and debugging.

  1. Install Visual Studio Code

Download and install the latest version of Visual Studio Code.

  1. Install Required Extensions

Install the following VS Code extensions to enable Java development:

  • Extension Pack for Java by Microsoft
    This pack includes essential extensions such as:

    • Language Support for Java™ by Red Hat
    • Debugger for Java
    • Java Test Runner
    • Maven for Java
    • Visual Studio IntelliCode

You can find and install this pack from the Extensions view (Ctrl+Shift+X) by searching for “Extension Pack for Java”

VS Code configuration

To enable remote debugging of a Java application running on a Nonstop system, you need to create a launch configuration in VS Code.

  1. Create a Launch Configuration
    1. Open your project in VS Code.
    2. Navigate to the Run and Debug view (Ctrl+Shift+D).
    3. Click on “create a launch.json file” if one does not already exist.
    4. Choose Java as the environment.
    5. Replace or add the following configuration in the launch.json file:

{

  "version": "0.2.0",

  "configurations": [

    {

      "type": "java",

      "name": "Debug (Attach) - Remote",

      "request": "attach",

      "hostName": "10.132.236.28",// replace with your Nonstop host

      "port": 8000, // replace with appropriate debug port

      "projectName": "vscode"

    }

  ]

}

Debugging standalone java application

DebugMe.java is a simple Java command-line program that prints a sequence of messages based on a user-specified count. It accepts the argument in the format -count <int>.

DebugMe.java is a simple Java command-line program that prints a sequence of messages based on a user-specified count

To compile this program on Nonstop, execute the following command:

javac -g DebugMe.java

To Run this program on Nonstop, execute the following command:

java DebugMe -count 5

To Run DebugMe.java on Nonstop, execute the following command:

To debug the DebugMe program using VS Code, start the Java application on the Nonstop system with the following command

java -cp .: -agentlib:jdwp=server=y,transport=dt_socket,address=8000 DebugMe -count 10

To debug the DebugMe program using VS Code, start the Java application on the Nonstop system with the following command

parameters passed:

  • agentlib:runjdwp: Enables the Java Debug Wire Protocol (JDWP), which allows remote debugging
  • transport=dt_socket: Specifies that the debugger should use a socket-based (TCP/IP) transport mechanism.
  • server=y: Configures the JVM to act as a debug server, waiting for a debugger (like VS Code) to attach.
  • address=8000: Sets the TCP/IP port on which the JVM listens for debugger connections. You can change this port if needed, but make sure it matches the port specified in your VS Code launch.json

 

To begin debugging your Java application:

  1. Open your project in Visual Studio Code.
  2. Go to the Run menu and select Start Debugging.
  3. Alternatively, you can press F5 to launch the debugger directly.

Once the debugger successfully attaches to the remote Java application, you will see the following screen

Once the debugger successfully attaches to the remote Java application, you will see the following screen

Variables view allows you to look at the content of the variables.

Variables view allows you to look at the content of the variables.Debug controls which appear on the top of the screen, allow you to step-in, step-out and resume.

Debug controls which appear on the top of the screen, allow you to step-in, step-out and resume.

Few other views on the left side panels are watch, breakpoint and call stack.

Few other views on the left side panels are watch, breakpoint and call stack.

Additional debug view can be opened using file menu “view” and click “open view”.

 

Debugging an application running in Pathway environment

 

You can debug a TS/MP Serverclass application in the same way as described for standalone Java applications. However, in the case of Pathway-managed serverclasses, the debugging options must be integrated into the serverclass configuration as below

SET SERVER AUTORESTART   3;

SET SERVER CREATEDELAY   3 SECS;

SET SERVER DEBUG OFF;

SET SERVER LINKDEPTH   1;

SET SERVER MAXSERVERS   1;

SET SERVER NUMSTATIC   1;

SET SERVER MAXLINKS   4;

SET SERVER PRI 138;

SET SERVER TMF   OFF;

SET SERVER DELETEDELAY   10 MINS;

SET SERVER PROCESSTYPE OSS;

set server cwd /home/senthil/demo

set server env classpath=/home/senthil/demo:.:

SET SERVER ARGLIST "-agentlib:jdwp=server=y,transport=dt_socket,address=8000", &

"JavaHelloServer",&

"10.132.236.28",&

"7110"

SET SERVER PROGRAM /usr/tandem/nssjava/jdk180_l80/bin/java

set server STDERR /home/senthil/demo/demo.log

set server STDOUT /home/senthil/demo/demo.std.out

 

  • maxservers 1 and numstatic 1

These values are set to 1 to ensure that only a single instance of the serverclass runs. This guarantees that the debugger attaches to the correct process.

  • Adding debug option in ARGLIST attribute “-agentlib:jdwp=server=y,transport=dt_socket,address=8000” same as standalone java program
  • Application

JavaHelloServer is a simple multithreaded server application written in Java. It listens for client connections, receives a string, and responds with a greeting message.

To begin debugging your Java application:

  1. Open your project in Visual Studio Code.
  2. Go to the Run menu and select Start Debugging.
  3. Alternatively, you can press F5 to launch the debugger directly.

After the debugger successfully attaches to the remote Java application, you will see the following screen

After the debugger successfully attaches to the remote Java application, you will see the following screenConclusion

This article briefly described a method to use GUI-based debugging of Java applications running on HPE Nonstop systems using Microsoft Visual Studio Code. By leveraging VS Code’s intuitive interface and built-in debugging tools.

 

  • Microsoft, Visual Studio, and Visual Studio Code are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
  • Java is a registered trademark of Oracle and/or its affiliates
  • Language Support for Java™ by Red Hat is a Visual Studio Code extension developed by Red Hat, Inc.

© Copyright 2025 Hewlett Packard Enterprise Development Company, L.P.

Author

  • T.Senthil Kumar

    Senthil Kumar T is a senior software engineer with over 18 years of experience in the Nonstop development team. Senthil is an active contributor to the HPE software products such as Database, NSDEE, API Gateway among others on the Nonstop.

    View all posts

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.