ERROR: JDWP Unable to get JNI 1.2 environment

元气小坏坏 提交于 2019-11-27 06:47:06

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).

Vasile Surdu

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.

Ian

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.

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