ERROR: JDWP Unable to get JNI 1.2 environment

本文记录了一个在使用Java调试过程中遇到的错误:AGENT_ERROR_NO_JNI_ENV,并提供了复现步骤及可能的原因。此错误与JVM关闭时调试代理仍在运行有关。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

调试代码时突然出现这个error,最终结果是这是一个没有解决的bug

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6476706

JDK-6476706 : Error AGENT_ERROR_NO_JNI_ENV printed sometimes to console when JVM finishes

 

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 = -2
JDWP 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&meta

I 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 SOMETIMES
printed 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.

这个bug可能再次运行就不能复现了,或者实在难以忍受error提示用system.exit(0).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值