Ant package jar, parameter name becomes meaningless Arg0,arg1,java code hint argument name meaningless

Source: Internet
Author: User
Tags vars

Symptoms:

Using the ant packaged jar, the variable becomes the following meaningless arg0,arg1. The code hints are the same. Using Eclipse's export jar is no problem


Workaround:

Let ant use the packaging capabilities of Eclipse.

1. Add debug= "True" debuglevel= "lines, VARs, source" in Build.xml's Javac command for the two line properties

2. Add <property name= "Build.compiler" value= "Org.eclipse.jdt.core.JDTCompilerAdapter" in Build.xml head ></ Property>

(Prevent class not found:org.eclipse.jdt.core.JDTCompilerAdapter problems)

3. Copy the Org.eclipse.jdt.core.jar and Jdtcompileradapter.jar into the Ant's Lib directory. (two files can be found in the installation directory of Eclipse, if not enough or lazy, click here to download.) At the end of this article, all-inclusive downloads are available, and if you have questions, you can download the full package.

Rerun the Build.xml file and the resulting jar will see the effect.


Explain:

    • The problem is that the ant package default Javac command is Debug=false.
    • When Debug opens, the jar package will be larger than the original package (my original 250K package, opened after debug to 320K, One-third larger)
    • If you just keep the variable name, you can abbreviate the debuglevel= "VARs" so that the jar package becomes smaller. (I've got a 320K bag here, it's 280K)
    • Debuglevel= the parameters of "lines, VARs, source" are described below

Lines: Writes the line number information from the source file to the class file, which is used to generate a mapping between the method byte stream offset and the source code line number in the class file. If this property is not specified, the printed line number is not visible in the stack exception information.
The Vars:local variable property establishes a mapping between the local variables part of the stack frame of the method and the local variable name and descriptor in the source code. With this property, when debugging, we can see the value of the variable.
Source: This property is specified at compile time, which writes the source file's property information, such as the source file name, to the class file

Download the required resources:

http://download.csdn.net/detail/landehuxi/8357897

Ant package jar, parameter name becomes meaningless Arg0,arg1,java code hint argument name meaningless

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.