I get this error after debugging in Eclipse. The debug is successful though.
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]
What does it mean?
Looks like http://bugs.sun.com/view_bug.do?bug_id=6476706 which has low priority and is still not fixed. Definitely a Mustang bug but no clear explanation (seems to occur pretty randomly according to the bug reporters on top of that).
Just add System.exit(0);
to the end of your main method.
That's all you have to do.
It's apparently a JVM bug. It's harmless and unpredictable.
Happens on something as simple as this tutorial
//trim spaces
String s2 = "Welcome!";
int len1 = s2.length();
System.out.println(len1);
String s3 = s2.trim();
System.out.println(s3.length());
Happens if run program too fast multiple times so something to do with system performance?
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:838]
@Everyone I'm facing this problem using the image API reading and writing files over the network, when I run the program working with local files this doesn't happen. After verifiying my results I confirmed that it really doesn't do any harm (at least on my debugging). Now that I'm reading this post I stopped looking into it.
I have noticed this occurs when I am using a workspace stored on my USB drive and sometimes on my work's network. It is not a major issue and doesnt seem to have any effect on the execution of any of my programs. I tested @Vasile Surdu's solution of addingSystem.exit(0);
to the end of the main method and it works. Another solution is to restart eclipse
which works for me most of the time.
来源:https://stackoverflow.com/questions/2225737/error-jdwp-unable-to-get-jni-1-2-environment