A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© cjc147 中级黑马   /  2016-9-6 20:58  /  1136 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

    在使用eclipse调试过程序以后,以后的程序运行结束时会偶尔遇到如下的问题:
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]

    我在google查过之后,发现这是个jdk的bug。Oracle公司已经在它的bug列表中对其做了相关的说明。链接见http://bugs.java.com/view_bug.do?bug_id=6476706
JDK-6476706 : Error AGENT_ERROR_NO_JNI_ENV printed sometimes to console when JVM finishes

Details
Type:
Bug
Submit Date:
2006-09-29
Status:
Open
Updated Date:
2012-01-24
Project Name:
JDK
Resolved Date:

Component:
core-svc
OS:
windows_xp
Sub-Component:
debugger
CPU:
x86
Priority:
P4
Resolution:
Unresolved
Affected Versions:
6
Targeted Versions:
tbd_major

Related Reports
[tr][td]


Sub Tasks
[tr][td]


Description
The following error is printed to console when debugger is about to finish:ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [../../../src/share/back/util.c:820]It was found by other people as well:http://www.google.co.uk/search?hl=en&q=AGENT_ERROR_NO_JNI_ENV%28183%29++util.c%3A820&btnG=Google+Search&metaI am able to reproduce it with NetBeans IDE (http://www.netbeans.org/issues/show_bug.cgi?id=85538):- install NetBeans IDE 6.0- create a java project- add two lines to main method (System.out.println("aaa");System.out.println("bbb");)- add breakpoint to the first line- start debugger (F5)- continue when it stops at breakpoint. The error message above is SOMETIMESprinted to output window.Build NB 6.0 20060919-0644, JDK1.6.0-b99, WindowsXP.An e-mail comment from Alan:> It sounds like a timing issue in the shutdown with the agent still running.
   有关心这个问题的人可能看到这么多英语就失去耐心了。在这里我作简要的说明:   这个问题就是jdk的一个bug,它是在开启了调试(debug)程序之后,没有关闭调试(debug)而造成的。   解决方法:        1.每次调试完程序之后,关闭debug;        2.在main方法中加上System.exit(0)
仅以此经验分享。

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马