问题描述
我目前正在IIS Express上运行的C#应用程序中通过 jni4net 使用Java库以及Java库引发异常.是否可以附加调试器来调试Java代码?
I'm currently using a Java library via jni4net in a C# application running on IIS Express, and the Java library is throwing an exception. Is it possible to attach a debugger to debug the Java code?
尝试:我尝试按照 IntelliJ :
setup.AddJVMOption("-agentlib", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
但有例外:
Unable to open debugger port : java.net.ConnectException "Connection refused: connect"
推荐答案
通过将AddJVMOption-String设置为:setup.AddJVMOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044");
By setting the AddJVMOption-String to:setup.AddJVMOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044");
我能够通过Eclipse连接到jni4net部分,也许您应该忽略第一个参数("-agentlib", ...)
I am able to connect to the jni4net part via Eclipse, maybe you should just omit the first argument ("-agentlib", ...)
当我使用setup.AddJVMOption("-agentlib", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
我在CreateJVM中收到异常
I get an Exception in CreateJVM
这篇关于是否可以调试在jni4net中运行的Java程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!