Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Run Application using Ant and Debug using Eclipse
Run Application using Ant and Debug using Eclipse [message #149681] Thu, 18 March 2004 12:57 Go to next message
Eclipse UserFriend
Hi-
This may seem strange..but I have a build.xml that can run the Java
Application using java task of Ant. Once the Application runs I want to
remote debug using Eclipse...basically I want to attach Eclipse debugger
to this.
Is this possible? Would It help if I start Ant build through Eclipse? I
doubt ...but let me know your views.
Re: Run Application using Ant and Debug using Eclipse [message #149691 is a reply to message #149681] Thu, 18 March 2004 13:15 Go to previous messageGo to next message
Eclipse UserFriend
You could start the Ant build via Eclipse but that would not help....but
that definitely has the cool factor :-)

You need to specify the correct VM args to the application that you are
starting from Ant.
So set your java task to fork and then use the nested <jvmarg> element(s) to
specify
something like:
<java classname="test.Main"
fork="yes" >

<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg
value=" -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=800 0 "/>
</java>

HTH
Darins

"rohitsoftware" <rohitsoftware@yahoo.com> wrote in message
news:c3cnth$1vq$1@eclipse.org...
> Hi-
> This may seem strange..but I have a build.xml that can run the Java
> Application using java task of Ant. Once the Application runs I want to
> remote debug using Eclipse...basically I want to attach Eclipse debugger
> to this.
> Is this possible? Would It help if I start Ant build through Eclipse? I
> doubt ...but let me know your views.
>
>
Re: Run Application using Ant and Debug using Eclipse [message #149709 is a reply to message #149691] Thu, 18 March 2004 14:13 Go to previous messageGo to next message
Eclipse UserFriend
Darin Swanson wrote:

> You could start the Ant build via Eclipse but that would not help....but
> that definitely has the cool factor :-)

> You need to specify the correct VM args to the application that you are
> starting from Ant.
> So set your java task to fork and then use the nested <jvmarg> element(s) to
> specify
> something like:
> <java classname="test.Main"
> fork="yes" >

> <jvmarg value="-Xdebug"/>
> <jvmarg value="-Xnoagent"/>
> <jvmarg value="-Djava.compiler=NONE"/>
> <jvmarg
> value=" -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=800 0 "/>
> </java>

> HTH
> Darins

> "rohitsoftware" <rohitsoftware@yahoo.com> wrote in message
> news:c3cnth$1vq$1@eclipse.org...
> > Hi-
> > This may seem strange..but I have a build.xml that can run the Java
> > Application using java task of Ant. Once the Application runs I want to
> > remote debug using Eclipse...basically I want to attach Eclipse debugger
> > to this.
> > Is this possible? Would It help if I start Ant build through Eclipse? I
> > doubt ...but let me know your views.
> >
> >

The reason I was doubtful about this was because Ant Manual states-
If odd things go wrong when you run this task, set fork="true" to use a
new JVM.

Note that you cannot interact with a forked VM, the only way to send input
to it is via the input and inputstring attributes.
Do you still think this will work?

Thanks.
Re: Run Application using Ant and Debug using Eclipse [message #149727 is a reply to message #149709] Thu, 18 March 2004 14:30 Go to previous messageGo to next message
Eclipse UserFriend
>
> The reason I was doubtful about this was because Ant Manual states-
> If odd things go wrong when you run this task, set fork="true" to use a
> new JVM.
>
> Note that you cannot interact with a forked VM, the only way to send input
> to it is via the input and inputstring attributes.
> Do you still think this will work?
>
> Thanks.
>

Try it and let us know :-)
Re: Run Application using Ant and Debug using Eclipse [message #149748 is a reply to message #149727] Thu, 18 March 2004 14:44 Go to previous messageGo to next message
Eclipse UserFriend
Darin Swanson wrote:

> >
> > The reason I was doubtful about this was because Ant Manual states-
> > If odd things go wrong when you run this task, set fork="true" to use a
> > new JVM.
> >
> > Note that you cannot interact with a forked VM, the only way to send input
> > to it is via the input and inputstring attributes.
> > Do you still think this will work?
> >
> > Thanks.
> >

> Try it and let us know :-)

It doesn't.
This is the core problem:
The classpath is too big to fit in DOS of Windows 2000.
The Eclipse Console doesn't allow to save seperately stdout and stderr in
file format. That's a bug ...but till now it doesn't.
I need the output to be saved while running in a seperate file.
I got Ant to run it. It takes care of both the above problems. But then I
cannot connect remotely using Eclipse Debugger? I am stuck. Is there a way
to solve the above problems and connect the App using Eclipse Debugger.
Re: Run Application using Ant and Debug using Eclipse [message #149756 is a reply to message #149748] Thu, 18 March 2004 15:30 Go to previous messageGo to next message
Eclipse UserFriend
"rohitsoftware" <rohitsoftware@yahoo.com> wrote in message
news:c3cu70$a0a$1@eclipse.org...
> Darin Swanson wrote:
>
> > >
> > > The reason I was doubtful about this was because Ant Manual states-
> > > If odd things go wrong when you run this task, set fork="true" to use
a
> > > new JVM.
> > >
> > > Note that you cannot interact with a forked VM, the only way to send
input
> > > to it is via the input and inputstring attributes.
> > > Do you still think this will work?
> > >
> > > Thanks.
> > >
>
> > Try it and let us know :-)
>
> It doesn't.
> This is the core problem:
> The classpath is too big to fit in DOS of Windows 2000.
> The Eclipse Console doesn't allow to save seperately stdout and stderr in
> file format. That's a bug ...but till now it doesn't.
> I need the output to be saved while running in a seperate file.
> I got Ant to run it. It takes care of both the above problems. But then I
> cannot connect remotely using Eclipse Debugger? I am stuck. Is there a way
> to solve the above problems and connect the App using Eclipse Debugger.
>

Well I just tried running a program from an Ant buildfile and then connected
to it with Eclipse..worked great.
My test:
<project default="remote">
<target name="remote">

<java classname="B" fork="true">
<classpath>
<pathelement path="bin" />
</classpath>
<jvmarg value="-Xdebug" />
<jvmarg value="-Xnoagent" />
<jvmarg value="-Djava.compiler=NONE" />
<jvmarg
value=" -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=800 0 " />
</java>

</target>
</project>

Set some breakpoints in the code that you wish to debug
I launched this Ant build in Eclipse.
Then I went Run>Debug...>Remote Java Application>New
Set the project (this is not required)
Debug


Darins
Re: Run Application using Ant and Debug using Eclipse [message #149785 is a reply to message #149756] Thu, 18 March 2004 16:16 Go to previous message
Eclipse UserFriend
Darin Swanson wrote:

> "rohitsoftware" <rohitsoftware@yahoo.com> wrote in message
> news:c3cu70$a0a$1@eclipse.org...
> > Darin Swanson wrote:
> >
> > > >
> > > > The reason I was doubtful about this was because Ant Manual states-
> > > > If odd things go wrong when you run this task, set fork="true" to use
> a
> > > > new JVM.
> > > >
> > > > Note that you cannot interact with a forked VM, the only way to send
> input
> > > > to it is via the input and inputstring attributes.
> > > > Do you still think this will work?
> > > >
> > > > Thanks.
> > > >
> >
> > > Try it and let us know :-)
> >
> > It doesn't.
> > This is the core problem:
> > The classpath is too big to fit in DOS of Windows 2000.
> > The Eclipse Console doesn't allow to save seperately stdout and stderr in
> > file format. That's a bug ...but till now it doesn't.
> > I need the output to be saved while running in a seperate file.
> > I got Ant to run it. It takes care of both the above problems. But then I
> > cannot connect remotely using Eclipse Debugger? I am stuck. Is there a way
> > to solve the above problems and connect the App using Eclipse Debugger.
> >

> Well I just tried running a program from an Ant buildfile and then connected
> to it with Eclipse..worked great.
> My test:
> <project default="remote">
> <target name="remote">

> <java classname="B" fork="true">
> <classpath>
> <pathelement path="bin" />
> </classpath>
> <jvmarg value="-Xdebug" />
> <jvmarg value="-Xnoagent" />
> <jvmarg value="-Djava.compiler=NONE" />
> <jvmarg
> value=" -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=800 0 " />
> </java>

> </target>
> </project>

> Set some breakpoints in the code that you wish to debug
> I launched this Ant build in Eclipse.
> Then I went Run>Debug...>Remote Java Application>New
> Set the project (this is not required)
> Debug


> Darins

I launched the Ant build outside Eclipse and tried with address=8000.
Earlier was using 5000. May be 5000 was a problem. Also, since my app
takes long to start I connected Eclipse pretty much after starting Ant. It
shows some threads and picked up.

Thanks.
Previous Topic:Java VM crash & IOException debugging
Next Topic:Possible to show the Java command on console?
Goto Forum:
  


Current Time: Tue Sep 16 08:16:27 EDT 2025

Powered by FUDForum. Page generated in 0.18647 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top