How to debug a java project using env variables?

View: New views
3 Messages — Rating Filter:   Alert me  

How to debug a java project using env variables?

by epdv :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello!

The only possible way to set variables before starting a java app in netbeans
seems to be using <exec>. Can I still debug the app using sth. like this?

<target depends="init,compile" name="debug-nb">
  <path id="cp">...</path>
  <nbjpdastart addressproperty="jpda.address"
               name="project"
               transport="dt_socket">
    <classpath refid="cp"/>
  </nbjpdastart>
  <exec executable="ant">
    <env>...</env>
    <arg>my-java-run.xml</arg>
    <arg>...more args...</arg>
  </exec>
</target>

with my-java-run.xml containing sth. like:

<target depends="init,compile" name="default">
    <java jvm="C:/jdk1.6.0/bin/java">
      <classpath refid="cp"/>
      <jvmarg value="-Xdebug"/>
      <jvmarg
        value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
    </java>
</target>

Will the called ant be a "private instance", i.e. will I be able to provide
my own InputHandler instance?

Kind regards

Peter Nabbefeld


Re: How to debug a java project using env variables?

by Jesse Glick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

epdv wrote:
> The only possible way to set variables before starting a java app in netbeans
> seems to be using <exec>.

You should be able to use <env> inside <java>. Currently the j2seproject
build-impl.xml does not let you do this, but you could just override
-init-macrodef-java in build.xml and add some <env>s according to your
needs.

> Will the called ant be a "private instance", i.e. will I be able to provide
> my own InputHandler instance?

If you run Ant forked using <exec> then you could provide custom input
handlers using Ant's normal command-line option. But I doubt this is
what you really want.


Re: How to debug a java project using env variables?

by epdv :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jesse Glick <jesse.glick <at> sun.com> writes:

>
> epdv wrote:
> > Will the called ant be a "private instance", i.e. will I be able to provide
> > my own InputHandler instance?
>
> If you run Ant forked using <exec> then you could provide custom input
> handlers using Ant's normal command-line option. But I doubt this is
> what you really want.

I need to use a server app, which has a toolshell implemented. The toolshell
opens correctly in the NetBeans output window, but input handling is slightly
incorrect. But that's not why I want to have my own InputHandler: I just
couldn't find out, how to programmatically send commands into the toolshell,
preferably using Ant.

Kind regards

Peter Nabbefeld


LightInTheBox - Buy quality products at wholesale price