ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Wolfe" <>
Subject 'java' ant task not displaying debug info
Date Fri, 02 Apr 2004 02:24:56 GMT
I am able to compile java code with 'debug' information turned,
but somehow line numbers are not appearing in my output when
I run the code via the 'java' task.  I can verify that the
class file and jar file that I build actually do have debug
information by running 'java' from the command line.  Any
suggestions on how to fix this?

(This problem also occurs with the 'junit' ant task)

Detailed information:

I have a build file where I compile code with debug on:


<target name="-compile" depends="-init" >
  <javac debug="true" debuglevel="lines, source" srcdir="${src}"
         destdir="${build}" classpathref="classpath">
      <pathelement path="${src}" />
      <pathelement path="${testsrc}" />

<target name="-jar" depends="-compile" >
  <mkdir dir="${dist}/lib"/>
  <jar jarfile="${dist}/lib/HelloWorld.jar" basedir="${build}">
      <attribute name="Main-Class" value="com.mytest.HelloWorld" />

<target name="run" depends="-jar"
     description="run the generated code">
  <java jar="${dist}/lib/HelloWorld.jar" fork="true" />

When I do 'ant run', I do not get debug information (line numbers):

$ ant run
     [java] Hello World
     [java] Exception in thread "main" java.lang.Exception: blah
     [java]    at com.mytest.HelloWorld.main(java.lang.String[]) (Unknown Source)
     [java] Java Result: 1

When I run from the command line I do get debug information:

$ cd dist/lib; /opt/SUNWappserver/jdk/bin/java -jar HelloWorld.jar; cd ../..
Hello World
Exception in thread "main" java.lang.Exception: blah
        at com.mytest.main(

-Greg Wolfe

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message