title: Using Netbeans for JNI debugging ( Java and C code )
body: <p>I am trying to write a simple Java application that calls a native method written in C. I am using Netbeans IDE and the code works perfectly but when I debug, there is no way I can hit the breakpoints in the native(C) code. </p>
  
  <p>I am using netbeans 7.1.2 with Mac OS X Lion. I have tried to start the Java project in Debug mode and then use the Debug/Attach Debugger/gdb method but it shows a debugger console with this message </p>
  
  <p>11-break-insert -f "/Users/user/NetBeansProjects/JniFileDemoCdl/JniFileDemo.c:8"
  12-break-insert -f "/Users/user/NetBeansProjects/JniFileDemoCdl/JniFileDemo.c:42"
  13-break-insert -f "/Users/user/NetBeansProjects/JniFileDemoCdl/JniFileDemo.c:80"
  14-exec-continue</p>
  
  <p>I don't know what to do beyond this step and how to hit the native breakpoints.</p>
  
  <p>Update : I have figured out the method to debug both C and Java code simultaneously in Netbeans. </p>
  
  <p>The way to do it is to start the Java project with breakpoints on the native methods. Then set the C project as the main project and use Attach Debugger to attach the java process to it. set the breakpoints in C code. When you do this the Java debugger windows gets hidden but on the lower left screen you can see a Sessions button. Click on that and get back to your Java session, when you step over the native method, the window moves you to the C code breakpoint but the debugging buttons are not active, once again Session buttons and select the C session and you will receive debug controls. Happy Debugging!</p>