String[] optionsAndSources = { "-g", "-source", "1.4", "-target", "1.4", "E:\\miniTools\\SunONE\\jboss-4.0.5.GA\\server\\default\\deploy\\ROOT.war\\WEB-INF\\classes\\Person.java"};
//com.sun.tools.javac.Main.compile(new String[]{"Person.java"});
// where Javac output goes
java.io.PrintWriter fOut = new java.io.PrintWriter( new java.io.FileWriter( "E:\\miniTools\\SunONE\\jboss-4.0.5.GA\\server\\default\\deploy\\ROOT.war\\WEB-INF\\classes\\Person.class" ) );
// Compile all three sources at once, 0 success
int status = com.sun.tools.javac.Main.compile( optionsAndSources, fOut );
fOut.close();
System.out.println( "status: " + status );
Java动态编译
最新推荐文章于 2023-03-30 22:10:57 发布