Here you can find the source of compile(String filename)
Parameter | Description |
---|---|
filename | a parameter |
public static boolean compile(String filename)
//package com.java2s; //it under the terms of the GNU Lesser General Public License as import javax.tools.*; public class Main { /**// w w w.j a v a2 s. c o m * Compiles the java program specified by filename. * * @param filename * @return true if it compiles, false otherwise */ public static boolean compile(String filename) { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); int compilationResult = compiler.run(null, null, null, filename); return compilationResult == 0; } }