Unfortunately this fix alone did not work for me. I discovered that when I updated to ant 1.6.1 the problem went away. After further investigation I've determined that there is a bug in the rpm (ant-1.5.2-23.i386.rpm) which RedHat Enterprise Linux provides.
If I run under 'classic-ant' rather than 'ant' then ant version 1.5.2 works fine. I've filed a bug regarding this with RedHat: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=120465 Thanks for your help, -Greg Wolfe --- Matt Benson wrote: I removed the space in "lines, source" and then got the line # info as desired. -Matt --- Greg Wolfe <[EMAIL PROTECTED]> wrote: > Matt, > > Your suggestion did not fix the problem. > (Note: I assume that you actually meant > 'add <sysproperty key="java.compiler" value="NONE" > /> > to the java task') > > Can you try running my example in your environment? > It would be helpful to isolate whether this problem > is general or specific to my environment. > > ( > $ ant -version > Apache Ant version 1.5.2-23 compiled on November 12 > 2003 > $ java -version > java version "1.4.2_04" > Java(TM) 2 Runtime Environment, Standard Edition > (build 1.4.2_04-b04) > Java HotSpot(TM) Client VM (build 1.4.2_04-b04, > mixed mode) > ) > > Thanks, > -Greg Wolfe > > > --- Matt Benson wrote: > > I actually meant to respond to your first query... > This is probably the JIT. You're already forking > the > JVM, but try to add a <sysproperty > name="java.compiler" value="NONE" /> > > -Matt > > --- Greg Wolfe wrote: > > I've posted on this before, but got no response so > > I've devised a simple test case that demonstrates > > the problem. > > > > When I compile with the 'javac' task in ant with > > 'debug' set to true, debug information is in the > > class file which is produced. I can verify this > by > > running 'java' from the command line. However, > when > > I run the 'java' ant task, debug information is > not > > shown. I'm running ant version 1.5.2-23 > > > > I would appreciate it if people can try out this > > program and report if they get the same result. > > > > Thanks, > > -Greg Wolfe > > > > ---- > > running from ant: > > > > $ ant > > Buildfile: build.xml > > > > init: > > [mkdir] Created dir: > > /home/gwolfe/msrc/emp/sample/build > > > > build: > > [javac] Compiling 1 source file to > > /home/gwolfe/msrc/emp/sample/build > > > > run: > > [java] Example String > > [java] Exception in thread "main" > > java.lang.Exception: This exception should log the > > line number > > [java] at Example.main(java.lang.String[]) > > (Unknown Source) > > [java] Java Result: 1 > > > > BUILD SUCCESSFUL > > Total time: 0 seconds > > > > > > ==> note the "Unknown Source" in the output. > > > > running java from the commandline: > > $ cd build; java Example; cd .. > > Example String > > Exception in thread "main" java.lang.Exception: > This > > exception should log the line number > > at Example.main(Example.java:15) > > > > ==> note that debug information is available > > > > > > --- > > src/Example.java: > > /** > > * Demo program to check if debug is enabled > > * @author Greg Wolfe > > */ > > > > > > > public class Example { > > public Example(String message) { > > this._message = message; > > } > > > > > > > public String getMessage() { > > return _message; > > } > > public static void main(String[] args) throws > > Exception { > > System.out.println(new Example("Example > > String").getMessage()); > > throw new Exception("This exception should > > log the line number"); > > } > > > > > > > private String _message; > > } > > > > > > > > > build.xml: > > <project name="CompileErrorDemo" default="run" > > basedir="."> > > <description> > > Demonstrate the lack of debug information in a > > case where it > > should be present. > > </description> > > > > > > > > > > <!-- properties that should not be changed --> > > > > > > > > > > <property name="src" location="src"/> > > <property name="build" location="build"/> > > > > > > > > > > <target name="init"> > > <mkdir dir="${build}"/> > > </target> > > > > > > > > > > <target name="build" depends="init" > > description="compile the source "> > > <javac debug="true" debuglevel="lines, source" > > srcdir="${src}" destdir="${build}" > > > <src> > > <pathelement path="${src}" /> > > </src> > > </javac> > > </target> > > > > > > > > > > <target name="run" depends="build" > > description="run the compiled code"> > > <java classname="Example" fork="true"> > > <classpath> > > <pathelement path="${build}"/> > > </classpath> > > </java> > > </target> > > > > > > > > > > <target name="clean" description="clean out the > > output directories" > > > <delete dir="${build}"/> > > </target>
