From a764e59e1d3a8e330f0d484fdb26b35ca3f0b2e4 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 22 Mar 2008 02:15:12 +0000 Subject: bringing pdj-0.8.3 into the main branch svn path=/trunk/externals/loaders/pdj/; revision=9621 --- src/java/com/e1/pdj/JavacCompiler.java | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/java/com/e1/pdj/JavacCompiler.java (limited to 'src/java/com/e1/pdj/JavacCompiler.java') diff --git a/src/java/com/e1/pdj/JavacCompiler.java b/src/java/com/e1/pdj/JavacCompiler.java new file mode 100644 index 0000000..7f2debe --- /dev/null +++ b/src/java/com/e1/pdj/JavacCompiler.java @@ -0,0 +1,34 @@ +package com.e1.pdj; + +import com.cycling74.max.MaxSystem; +import java.io.File; + +class JavacCompiler extends GenericCompiler { + + public JavacCompiler() { + super("javac"); + } + + String javacPath() { + String fullPath = System.getProperty("pdj.JAVA_HOME"); + File test = new File(new File(fullPath, "bin"), "javac"); + if ( test.exists() ) { + return test.getAbsolutePath(); + } + MaxSystem.post("unable to find 'bin/javac' from the JAVA_HOME, using PATH"); + return "javac"; + } + + void compileClass() throws PDJClassLoaderException { + String args = javacPath() + " " + resolvJavaFile() + + " -classpath " + getConfigurationClassPath() + + " -sourcepath " + PDJClassLoader.fclasses.toString(); + + int rc = exec(args); + + if ( rc != 0 ) { + throw new PDJClassLoaderException("pdj: compiler returned: "+ rc + ",args: " +args); + } + MaxSystem.post("pdj: compile successful"); + } +} -- cgit v1.2.1