Click here to Skip to main content
Click here to Skip to main content

Debug Java Code in Java COM Windows Application (Remote Java Debugging)

, 18 Oct 2013
Rate this:
Please Sign up or sign in to vote.
Debugging Java JNI and C++ code in COM based application

Introduction

I recently got the chance to setup Java debug environment for Java-COM based Windows application. Here the VB6 code is used for showing the User interface of application while Java and C++ code includes business logic of the application. To fix some bugs in the application, a debug environment was required which allows users to debug Java and C++ JNI code.

Using the Code

To debug C++, I used Visual Studio attach to process method and for Java code remote Java debugging of Eclipse was used.

Here are the details of the process that I used to debug Java.

We need to implement the following two steps:

  1. Launch the application and tell the JVM that it will be debugged remotely
  2. Create debug configuration in Eclipse IDE to debug application remotely. (in our case, it is localhost)

Pass the following argument to JVM:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8998

The above code should be placed at the location where JVM is loaded in the code.
Here 8998 denotes the port and suspend=n will make sure that the debugging is suspended till the Java code hits in the application.

In the Eclipse IDE, we need to create a new debug configuration and enter the following details in Connection Properties:

  • Host - localhost
  • Port - 8998

Now, click on apply, then launch the application. Now click on Debug in Debug configuration after setting debug points in the Java code.

Points of Interest

Using the above steps, we can debug the C++ and Java code simultaneously. This helped to understand proper functions flow in application.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Vivek Goyal
Software Developer (Senior)
India India
I am software developer. Worked on C++, COM, .NET, C#, Java, Installshield, Joomla.
Here are my blogs -
http://newapputil.blogspot.in/
http://nvivekgoyal.blogspot.in/

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 18 Oct 2013
Article Copyright 2013 by Vivek Goyal
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid