问题
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