I am encountering the same error many times which has been discussed on Stack overflow before. For example here. My error says "Failed to connect to VM" when I right click on a java file, click on Debug As, selects Debug Configurations and then click on Debug button.One thing is different for me as compared to other people experiences mentioned in other posts on Stack overflow, I have noticed is that I only get this error when I try to follow the above steps on different java file after performing the same steps on some different file.
The quick fix I use every time is to shutdown the tomcat and then start again using catalina jpda start which is time consuming. I am wondering if there is any permanent fix available for this problem?
I am using Windows 10.


