dcsimg

How can I invoke the javac compiler from within a Java program?

Luigi Viggiano

This shows you how to call javac compiler by Java code:


    static public void main(String[] args) throws Exception{
        com.sun.tools.javac.Main compiler = new com.sun.tools.javac.Main();
        compiler.compile(args);
    }