Eclipse is showing Cannot connect to VM error while i opened any Program in debug mode.. Here is Exception stack
java.net.SocketException: socket closed
at java.net.PlainSocketImpl.socketAccept(Native Method) //I dont know which socket is closed in my PC
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:453)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.eclipse.jdi.internal.connect.SocketTransportService.accept(SocketTransportService.java:95)
at org.eclipse.jdi.internal.connect.SocketTransportImpl.accept(SocketTransportImpl.java:56)
at org.eclipse.jdi.internal.connect.SocketListeningConnectorImpl.accept(SocketListeningConnectorImpl.java:135)
at org.eclipse.jdt.internal.launching.StandardVMDebugger$ConnectRunnable.run(StandardVMDebugger.java:107)
at java.lang.Thread.run(Thread.java:619)
Even my Localhost is working fine,i pinged 127.0.01 and localhost both is working fine,Even i restarted my PC even getting the same error. dont know which socket is closed in my PC.Kindly help me..I am using eclipse 8.x
This is because of the localhost setting in your machine. check your ip against localhost in hosts file in /etc folder
将127.0.0.1 localhost
添加到 /etc/hosts,在我的 mac 上解决了同样的问题!
Adding the following to the eclipse.ini
file make this issue resolve:
-vm
C:\Program Files\Java\jdk1.7.0_71\jre\bin\javaw.exe (path of javaw.exe )
Make sure path of javaw.exe
should be written in next line of -vm
.
Here's my eclipse.ini
file:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20140116-2212
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\jdk1.7.0_71\jre\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
If you are a MAC user use following steps
sudo -su root
vi /etc/hosts
---> now insert following line and save the file opened in vi editor
127.0.0.1 localhost
one of the solution is after creating a project , "click next" , enter image description here " not finish"
uncheck the box "create module-info.java file"
I encountered this problem using Springsource's version of eclipse. My problem was that my Debug Configuration was defined to use the Javascript debugger, and I was trying to debug a Java program.
Solution: go to "Debug As" -> "Debug Configurations", and somewhere in that window (at the end in my case SpringSource 3.1) set the Eclipse JDT Launcher as the debugger option.
one of the basic solution is
when your creating new project uncheck the box "create module-info.java file"
(click next next finish) enter image description here
Right click your project name, then select Build Path->Configure Build Path. Click on the Libraries tab and check if your libs (especially Tomcat libs) are under "Modulepath" and not "Classpath". In my case, my project needs Tomcat libs. When I put Tomcat libs under "Classpath", it does not work. When I move the libs to "Modulepath", it works. 1
I my case on Windows 10 machine it was the wrong JRE selected for the project causing the error.
Only the default JRE installed in the user's home directory was initially listed (in Eclipse - Window->Preferences->Java->JRE). I have added two other JREs.
Next I went into the project, selected the package I wanted to debug, went to the "Debug Configurations" and selected one of the freshly added JRE (in my case Java15).
Afterwards debugging started to work just fine.
删除我的module-info.java
文件为我解决了这个问题。
You need to start you server with debug port enabled and connect the debugger with the server using the same port.
For "Tomcat" server, you can add the following to start it in debug mode with debug port as 8453
.
-Xdebug -Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=n
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.