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