KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > tools > OPP > OPPCompilerFactory


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
//
5
// $Id: OPPCompilerFactory.java,v 1.2.2.1 2004/01/11 20:42:34 per_nyfelt Exp $
6
package org.ozoneDB.tools.OPP;
7
8 import org.ozoneDB.tools.OPP.compiler.JavaCompiler;
9 import org.ozoneDB.tools.OPP.compiler.AbstractJavaCompiler;
10 import org.ozoneDB.tools.OPP.compiler.InternalJavaCompiler;
11 import org.ozoneDB.tools.OPP.compiler.ExternalJavaCompiler;
12
13 import java.io.File JavaDoc;
14
15 public class OPPCompilerFactory {
16
17
18     public static JavaCompiler getCompilerInstance(File JavaDoc sourceDir, File JavaDoc outputDir) {
19         //System.out.println("sourceDir=" + sourceDir.getAbsolutePath() + " outputDir=" + outputDir.getAbsolutePath());
20
AbstractJavaCompiler compiler;
21         String JavaDoc jvmClassPath = System.getProperty("java.class.path", "");
22         String JavaDoc compilerCommand = System.getProperty("ozone.javac", "");
23         if (compilerCommand.equals("")) {
24             compiler = new InternalJavaCompiler();
25         } else {
26             compiler = new ExternalJavaCompiler(compilerCommand);
27         }
28         compiler.setDebug(true);
29         compiler.setDeprecation(true);
30         compiler.setOptimize(false);
31         compiler.setClasspath(jvmClassPath);
32         compiler.setSourcePath(sourceDir);
33         compiler.setOutputPath(outputDir);
34
35         //System.out.println("Compiler classpath: " + jvmClassPath);
36
return compiler;
37     }
38 }
39
Popular Tags