1 package jester; 2 3 import java.io.IOException ; 4 5 public class RealCompiler implements Compiler { 6 private Configuration myConfiguration; 7 8 public RealCompiler(Configuration aConfiguration) { 9 super(); 10 myConfiguration = aConfiguration; 11 } 12 13 public static void main(String args[]) throws IOException , SourceChangeException { 14 new RealCompiler(new RealConfiguration(RealConfiguration.DEFAULT_CONFIGURATION_FILENAME)).compile(args[0]); 15 } 16 17 public void compile(String sourceFileName) throws SourceChangeException { 18 19 String [] commandLine = new String [4]; 20 commandLine[0] = myConfiguration.compilationCommand(); 21 commandLine[1] = "-classpath"; 22 commandLine[2] = System.getProperty(MainArguments.CLASSPATH_PROPERTY); 23 commandLine[3] = sourceFileName; 24 try { 25 Util.runCommand(commandLine, myConfiguration.getLogger()); 26 } catch (IOException e) { 27 throw new SourceChangeException("couldn't compile " + sourceFileName); 28 } 29 } 30 } | Popular Tags |