从 Eclipse 查看本机代码
我有一个使用本地方法调用的 java 应用程序.有没有办法在 eclipse 中查看此代码?我可以得到这个本机库的源代码,但不知道如何在 IDE 中链接.如果有人告诉我如何调试这个本机方法也会很有帮助.
I have a java application which makes use of native method calls.Is there a way to view this code in eclipse? I can get the source code for this native library, but do not know how to link in the IDE. It will also be helpful if someone tells me how to debug this native method.
推荐答案
不是一个完整的答案,但 Eclipse 确实有 C/C++ IDE 功能
Not a full answer, but Eclipse does have C/C++ IDE functionality
这里有一些信息(虽然看起来有点过时):关于 CDT/JDT 集成的信息
Here is some information (though it seems a bit dated): Information on CDT/JDT integration
从 Eclipse 内部创建 JNI 代码的信息 (看最后一个帖子)
在 Eclipse 的能力范围内,集成的调试体验看起来确实不错,但它显然不是特别重要.
It does seem like an integrated debugging experience would be well within Eclipse's capabilities, but it's obviously not hyper important.
好的 - 说了这么多,我确实记得让 Visual C++ 调试器与进行 JNI 调用的 Java 应用程序一起工作......这已经有一段时间了,但我很确定你可以将 C++ 调试器连接到使用 pid 的正在运行的 Java 应用程序.然后设置断点,开始摇滚(显然你必须将 JNI 库编译为调试模块).
OK - all that said, I do have a recollection of getting Visual C++ debugger to work with a Java application that was making JNI calls... It's been awhile, but I'm pretty sure you can connect the C++ debugger to the running Java application using the pid. Then set a breakpoint, and rock and roll (you'll obviously have to compile the JNI library as a debug module).
这不是一个完全集成的体验,但它非常有效.不过,我尝试将我的 JNI 代码编写为原生调用的精简包装器,因此我很少花时间调试我的 JNI 调用.
It wasn't a fully integrated experience, but it was pretty effective. I try to write my JNI code as thin wrappers around the native calls, though, so I spend very little time debugging my JNI calls.
相关文章