1

I am trying to debug my simple program in Eclipse. When I run it, the program runs as expected. But when I try to debug it, the program output is as expected but there is an error

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [util.c:838]

I would like to use the advantage of debugging mode. I want to know how to tweak this error.

Darwin
  • 23
  • 5
  • Looks like you didn't search SO for the error text. Try this QA and see if it helps you: http://stackoverflow.com/questions/2225737/error-jdwp-unable-to-get-jni-1-2-environment#2225806 – lea Dec 16 '14 at 08:48
  • It's my bad.Still learning how to use Stackoverflow. Thanks Lea – Darwin Dec 16 '14 at 09:32
  • This question is similar to one which already has an answer: http://stackoverflow.com/questions/2225737/error-jdwp-unable-to-get-jni-1-2-environment – Stacky Nov 29 '15 at 11:40

2 Answers2

0

Use

System.exit(0); 

at the end of main() method

Marcin Szymczak
  • 11,199
  • 5
  • 55
  • 63
0

That is a bug when you have some breakpoints marked. Simply the easiest way is to clear all breakpoints in your code. That worked for me. To find all breakpoints switch to DEBUG mode.

Andrew_Dublin
  • 745
  • 6
  • 22