Use eclipse JDT compile class to solve the problem of determining the type parameters of X. For a maximum of X, java. lan

Source: Internet
Author: User

When the ant command line method is used to execute build javac to compile the class, the type parameter of <X> X cannot be determined if the generic type cannot be converted; for the maximum value of X, java. lang. the Object type variable X does not have a unique maximum instance solution: You need to use eclipse's jdt to compile the class and cannot use the default javac compilation method. Find org. eclipse. jdt. in core_3.5.2.v_981_R35x.jar, find jdtCompilerAdapter. jar and org. eclipse. jdt. compiler. tool_1.0.100.v_972_R35x.jar org. eclipse. jdt. core_3.5.2.v_981_R35x.jar org. eclipse. jdt. debug. ui_3.4.1.v20090811_r351.jar jdtCompilerAdapter. jar and copy it to ant_home/lib. In ant build. add <property name = "build. compiler "value =" org. eclipse. jdt. core. JDTCompilerAdapter "/> <javac nowarn =" false "debug =" true "debuglevel =" source, lines, vars "destdir =" $ {dist. path}/classes "source =" 1.6 "target =" 1.6 "encoding =" UTF-8 "fork =" true "memoryMaximumSize =" 512 m "includeantruntime =" false "> or <javac compiler = "org. eclipse. jdt. core. JDTCompilerAdapter "nowarn =" false "debug =" true "debuglevel =" source, lines, vars "destdir =" $ {dist. path}/classes "source =" 1.6 "target =" 1.6 "encoding =" UTF-8 "fork =" true "memoryMaximumSize =" 512 m "includeantruntime =" false "/> If yes use eclipse to run the ant script, right-click the menu and select start build from RUN as Ant. in xml, select Runtime jRE: run in the same JRE as workspace in the dialog box. image
Remember to introduce the jar packages required above

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.