Remote debugging a Java application

前端 未结 6 1913
我在风中等你
我在风中等你 2020-11-22 07:24

I have a java application running on linux machine. I run the java application using the following:

java myapp -Xdebug -Xrunjdwp:server=y,transport=dt_socke         


        
6条回答
  •  Happy的楠姐
    2020-11-22 07:50

    This is how you should setup Eclipse Debugger for remote debugging:

    Eclipse Settings:

    1.Click the Run Button
    2.Select the Debug Configurations
    3.Select the “Remote Java Application”
    4.New Configuration

    • Name : GatewayPortalProject
    • Project : GatewayPortal-portlet
    • Connection Type: Socket Attach
    • Connection Properties: i) localhost ii) 8787

    For JBoss:

    1.Change the /path/toJboss/jboss-eap-6.1/bin/standalone.conf in your vm as follows: Uncomment the following line by removing the #:

    JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"
    

    For Tomcat :

    In catalina.bat file :

    Step 1:

    CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
    

    Step 2:

    JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
    

    Step 3: Run Tomcat from command prompt like below:

    catalina.sh jpda start
    

    Then you need to set breakpoints in the Java classes you desire to debug.

提交回复
热议问题