Unable to debug in Java with eclipse

后端 未结 11 894
情话喂你
情话喂你 2020-12-03 06:55

I am trying to debug a simple Java application on my machine using Eclipse as an IDE. When I try to debug the application by entering the Debug Perspective, I set a breakpoi

相关标签:
11条回答
  • 2020-12-03 07:44

    Its Very Simple,Just do the Following Changes in eclipse.ini file.

    -vm
    binary\com.sun.java.jdk.win32.x86_1.6.0.u43\jre\bin\javaw.exe
    
    0 讨论(0)
  • 2020-12-03 07:47

    My cause & solution were completely different.
    I think in my case it was due to the installation of JProfiler. I fixed it by uninstalling JProfiler and launching eclipse with the -clean option. I suspect that JProfiler was inserting itself in the debugger. The -clean option forces Eclipse to re-assess its plugins, so that alone might have been sufficient.

    0 讨论(0)
  • 2020-12-03 07:52

    I changed

    -agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y
    

    to

    -agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n
    

    and that did the trick!

    0 讨论(0)
  • 2020-12-03 07:54

    I just had the same problem.

    Yesterday everything worked fine, now nothing - same error as you gave. I found out that network admins made some changes in the meantime. Some firewall stuff. Problem is that Eclipse tries to establish connection to JVM at "localhost" (and some random port). When I tried pinging localhost (or 127.0.0.1) I got following:

    C:\Windows\system32>ping 127.0.0.1
    Pinging 127.0.0.1 with 32 bytes of data:
    PING: transmit failed. General failure.
    PING: transmit failed. General failure.
    PING: transmit failed. General failure.
    PING: transmit failed. General failure.
    

    and

    C:\Windows\system32>ping localhost
    Ping request could not find host localhost. Please check the name and try again.
    

    It seams that in some cases DNS is expected to resolve this, and if firewall prevents localhost requests to DNS - stuff breaks. I had to alter hosts file and remove comments in following lines, so I would not rely on DNS for this anymore:

    # 127.0.0.1       localhost
    # ::1             localhost
    

    Although it is written that hosts file changes take effect immediately, I think that some processes locked this and restart was necessary in my case. After that, everything worked again.

    0 讨论(0)
  • 2020-12-03 07:55

    I was getting the same error on my ubuntu machine because of a mishap with the /etc/hosts file. I had commented out the mapping of localhost to 127.0.0.1, and to complicate matters further there was a swap file hanging around.

    This was the first line of my /etc/hosts:

    127.0.0.1       #localhost
    

    Deleting the # fixed the problem, whereas rebooting understandably had not.

    0 讨论(0)
提交回复
热议问题