Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Debugging java code invoked from a C++ application
Debugging java code invoked from a C++ application [message #242756] Wed, 11 April 2007 19:16 Go to next message
Connie Lam is currently offline Connie LamFriend
Messages: 24
Registered: July 2009
Junior Member
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 #242802 is a reply to message #242756] Thu, 12 April 2007 22:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

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
Re: Debugging java code invoked from a C++ application [message #242833 is a reply to message #242802] Fri, 13 April 2007 02:45 Go to previous message
Connie Lam is currently offline Connie LamFriend
Messages: 24
Registered: July 2009
Junior Member
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
Previous Topic:Sample JDT code -
Next Topic:Recommended way to use AST to do template-based code gen?
Goto Forum:
  


Current Time: Wed Jul 17 13:57:21 GMT 2024

Powered by FUDForum. Page generated in 0.04225 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top