dcsimg
Compiled Class Sizes Differ
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Albert_Bupp
Posted On:   Monday, September 17, 2001 02:37 PM

Greetings Folks, I just installed Ant today, and configured my 1st project. So far I'm quite impressed. However, I've noticed an oddity that I haven't been able to find an explanation for, despite spending much of the day pouring over the documentation. The Java class files built when invoking Ant's javac task come out ~10% smaller than what I get when simply invoking javac directly from the command line. Although this looks like a good thing , and doesn't appear to cause any problems in the resulting application, it does make me nervous about the possible repercussions of switching to Ant for project that has undergone significant testing. I'd like to avoid having to do a full regression test j   More>>

Greetings Folks,


I just installed Ant today, and configured my 1st project. So far I'm quite impressed.


However, I've noticed an oddity that I haven't been able to find an explanation for, despite spending much of the day pouring over the documentation. The Java class files built when invoking Ant's javac task come out ~10% smaller than what I get when simply invoking javac directly from the command line.


Although this looks like a good thing , and doesn't appear to cause any problems in the resulting application, it does make me nervous about the possible repercussions of switching to Ant for project that has undergone significant testing. I'd like to avoid having to do a full regression test just because of employing Ant.


As far as I can tell the javac arguments are the same for each type of invocation. Ant seems to be using the same version of javac that I'm accessing from the command prompt. I've tried turning off the includeAntRuntime attribute, as well as setting the build.compiler property.


Any possible explanations for this seemingly strange behavior would be greatly appreciated.


Thanks, Albert

   <<Less

Re: Compiled Class Sizes Differ

Posted By:   Gray_Herter  
Posted On:   Wednesday, October 3, 2001 03:43 PM

The javac task's debug attribute uses the -g:none flag when it is set "off". This compiles without source, line, and local variable information in the .class files. From the command line, "javac foo.java" will give you the source and line info in the .class file. "javac -g:none foo.java" will be smaller but lack the source and line information. That is probably the difference you see.

Usually during development you will want the source and line info so that your stack dumps will contain the file names and line numbers.

Look at http://java.sun.com/j2se/1.3/docs/tooldocs/win32/javac.html#options for more information on the -g option.

Re: Compiled Class Sizes Differ

Posted By:   Erik_Hatcher  
Posted On:   Monday, September 17, 2001 07:33 PM

At the command-line are compiling with debug or optimize enabled? Both of these default to 'off' using the task, unless otherwise enabled.
About | Sitemap | Contact