view native code from Eclipse(从 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.
这篇关于从 Eclipse 查看本机代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 Eclipse 查看本机代码
基础教程推荐
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 在螺旋中写一个字符串 2022-01-01