Is it possible to debug a Java program running in jni4net?

岁酱吖の 提交于 2019-12-13 15:22:56

问题


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?

Attempt: I tried to add the following to the JVM options as per the instructions provided by IntelliJ:

setup.AddJVMOption("-agentlib", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");

but get an exception:

Unable to open debugger port : java.net.ConnectException "Connection refused: connect"

回答1:


By setting the AddJVMOption-String to: setup.AddJVMOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044");

I am able to connect to the jni4net part via Eclipse, maybe you should just omit the first argument ("-agentlib", ...)

When I use setup.AddJVMOption("-agentlib", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");

I get an Exception in CreateJVM



来源:https://stackoverflow.com/questions/28308402/is-it-possible-to-debug-a-java-program-running-in-jni4net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!