aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/e1/pdj/JavacCompiler.java
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-03-22 02:15:12 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-03-22 02:15:12 +0000
commita764e59e1d3a8e330f0d484fdb26b35ca3f0b2e4 (patch)
treec4ecadccdecf2809b99c0da0545f255a6ad25bb5 /src/java/com/e1/pdj/JavacCompiler.java
bringing pdj-0.8.3 into the main branchsvn2git-root
svn path=/trunk/externals/loaders/pdj/; revision=9621
Diffstat (limited to 'src/java/com/e1/pdj/JavacCompiler.java')
-rw-r--r--src/java/com/e1/pdj/JavacCompiler.java34
1 files changed, 34 insertions, 0 deletions
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");
+ }
+}