KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jester > RealCompiler


1 package jester;
2
3 import java.io.IOException JavaDoc;
4
5 public class RealCompiler implements Compiler JavaDoc {
6     private Configuration myConfiguration;
7
8     public RealCompiler(Configuration aConfiguration) {
9         super();
10         myConfiguration = aConfiguration;
11     }
12
13     public static void main(String JavaDoc args[]) throws IOException JavaDoc, SourceChangeException {
14         new RealCompiler(new RealConfiguration(RealConfiguration.DEFAULT_CONFIGURATION_FILENAME)).compile(args[0]);
15     }
16
17     public void compile(String JavaDoc sourceFileName) throws SourceChangeException {
18         
19         String JavaDoc[] commandLine = new String JavaDoc[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 JavaDoc e) {
27             throw new SourceChangeException("couldn't compile " + sourceFileName);
28         }
29     }
30 }
Popular Tags