Hi, 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.
To debug C++, I used Visual studio attach to process method and for Java code remote Java debugging of eclispe was used.
Here is the details of process that I used to debug Java-
We need to implement following two steps -
Pass 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 ecplise IDE we need create a new debug configuration and enter 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.
To debug C++, I used Visual studio attach to process method and for Java code remote Java debugging of eclispe was used.
Here is the details of process that I used to debug Java-
We need to implement following two steps -
- Launch the application and tell the JVM that it will be debugged remotely
- Create debug configuration in eclispe IDE to debug application remotely. (in our case it is localhost)
Pass 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 ecplise IDE we need create a new debug configuration and enter 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.
Very Nice Work :)
ReplyDeletethank you :)
Delete