Implementation of the Atitit.java eval function Compiler API

Source: Internet
Author: User
Tags java se

Implementation of Atitit.java eval function Compiler API

Output Echo 2

Output Directory Configuration 2

for compilers, The JDK is designed with two interfaces, namely Javacompiler and javacompiler.compilationtask .

Private static void T () throws FileNotFoundException {

// String fullquanlifiedfilename = "Compile" + Java.io.File.separator +

//     "Target.java";

String Fullquanlifiedfilename =pathx. Prjpath ()+ "/src/aaaaacompiler/target.java" ;

Javacompiler compiler = Toolprovider. Getsystemjavacompiler ();

// FileOutputStream err = new FileOutputStream ("Err.txt");

Com.sun.tools.javac.api.JavacTool @2133c8f8 ==compiler,

String string  = "-xlint:deprecation" ;

string ="-D c:\\00output";

int Compilationresult = compiler. Run (NULL, NULL, NULL,"-D","C:\\00output", Fullquanlifiedfilename);

if(compilationresult = = 0) {

System. out . println ("Done");

} else {

System. out . println ("Fail");

}

}

Javac: File not found: Compile\target.java

usage : Javac <options> <source files>

-help is used to list possible options

Fail

output echo

int Compilationresult = compiler. Run (NULL, NULL, NULL,"-D","C:\\00output", Fullquanlifiedfilename);

Output Directory Configuration

author::  Nickname :Old Wow's claws( Full Name::AttilaxAkbar Al Rapanui Attilaksachanui) 

Kanji Name: Etila ( Ayron) , email:[email protected]

reprint Please indicate source: http://www.cnblogs.com/attilax/

Resources

Java SE 6 new features _ Compiler api.html

Java Dynamic Compilation notes-Tian Astrological-blog park. html

A Tiend

Implementation of the Atitit.java eval function Compiler API

Related Article

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.