Debugging java code invoked from a C++ application [message #242756] |
Wed, 11 April 2007 15:16  |
Eclipse User |
|
|
|
Hi,
I have a C++ application that invokes Java code when the user performs a
certain action. Is there a way for me to debug such java code? E.g. can I
attach a jvm to jdt, just like attaching a process to C++ debugger when
debugging jni code?
Thanks,
Connie
|
|
|
|
Re: Debugging java code invoked from a C++ application [message #242833 is a reply to message #242802] |
Thu, 12 April 2007 22:45  |
Eclipse User |
|
|
|
Eric Rizzo wrote:
> Connie wrote:
>> Hi,
>>
>> I have a C++ application that invokes Java code when the user performs a
>> certain action. Is there a way for me to debug such java code? E.g. can
>> I attach a jvm to jdt, just like attaching a process to C++ debugger
>> when debugging jni code?
> It is not clear what is happening. For example, how does C++ code invoke
> Java code?
> You can certainly attach the JDT debugger to any JVM, assuming you can
> control the start-up parameters of that JVM to specify the appropriate
> debug params (a JVM has to be started with specific params in order to
> enable debug mode). The Eclipse Help has lots of information related to
> this, which is called "Remote Debugging" (even when the JVM is on the
> same machine).
> But the question remains for you, how is the C++ app launching Java?
> Hope this helps,
> Eric
Thanks Eric for your help! I am now able to debug my Java code!
I started a JVM in my C++ code by specifying the necessary class paths,
and used CallStaticVoidMethod to make a call to the Java code. I also
added the following lines to my C++ code to enable debug mode:
options[3].optionString = "-Xdebug";
options[4].optionString =
" -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend= n ";
Then I created a remote launch configuration, specified localhost as the
host and 8000 as the port, and ran it in debug mode.
Connie
|
|
|
Powered by
FUDForum. Page generated in 0.03566 seconds