Error Message "Cannot connect to VM"

Last edited on

When using Eclipse as the AUT and trying to start the Java debugger it is possible that an error occurs which results in a dialog like this popping up:

Problem Occurred

'Launching myapp' has encountered a problem.

Cannot connect to VM socket closed

|OK|

The console view shows:

NPT ERROR: Cannot open library

Solution

To avoid this problem unset the environment variable JDK_ALTERNATE_VM before starting Eclipse. This could be done, for example, in a batch file:

set _JDK_ALTERNATE_VM=%JDK_ALTERNATE_VM%
set JDK_ALTERNATE_VM=
eclipse -vm "%_JDK_ALTERNATE_VM%"