ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <>
Subject Re: Running java program in debug mode
Date Wed, 23 Aug 2006 18:13:01 GMT
Hello Vinod,

use these arguments :

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044

and create a remote debugging configuration in Eclipse, using the same port 1044 (can be another
number as long as it is the same to start java and in Eclipse)

Also add something like 
in your main method,
so that you have the time to connect to your program from within Eclipse after you have started

The sequence of operation is :

create the remote debugging configuration in eclipse
start ant
when ant reaches the point where your Helloworld program starts executing,
start the debugging in Eclipse. You know that it works when Eclipse displays a message like
"connected with remote VM". You will then see in the editor that you are at the line of code
saying Thread.sleep.

You can then debug "normally".

Good luck.


-------- Original-Nachricht --------
Datum: Wed, 23 Aug 2006 08:35:50 -0400
Betreff: Running java program in debug mode 

> Hi All,
>       I created a Java project with a HelloWorld  java program . I use ant
> to build and run it.It runs fine.But when i want to run using eclipse
> debugger It did not stop at break points to let me step through the
> program.
> <target name="compile" depends="init"
>         description="compile the source " >
>     <!-- Compile the java code from ${src} into ${build} -->
>     <javac srcdir="${src}" debug="true" destdir="${build}"/>
> </target>
> <target name="run" depends="init" description="Run the java remote client"
> >
>   <java dir="." classname="com.test.HelloWorld" fork="yes"
> failonerror="yes" >
>    <sysproperty key="DEBUG" value="true"/>
>    <jvmarg value="-Xdebug"/>
>    <jvmarg value="-Xnoagent"/>
>    <jvmarg value="-Djava.compiler=none"/>
>    <classpath>
>    <pathelement location="${dist}/lib/MyProject-${DSTAMP}.jar"/>
>     </classpath>
>   </java>
> </target>
> Please help me to make the necessary changes in my script , so i can debug
> standalone java programs also.
> Thanks for the help.
> Regards,
> Vinod

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message