aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2011-06-20 16:15:06 -0700
committerShawn O. Pearce <sop@google.com>2011-06-20 16:15:33 -0700
commit7844ba4f55af24adc7a7dd074891b243650e7fca (patch)
tree44208455c6d41b94c721206614447da61d49b772
parentdbaf960696bae679fec66440fbcd5a1bf3b9a799 (diff)
downloadprolog-cafe-7844ba4f55af24adc7a7dd074891b243650e7fca.tar.gz
Fix Compiler to load from its own ClassLoader
The compiler class needs to ensure the PrologClassLoader that will be run to perform the Prolog->Java translation can actually see the Prolog predicates containing the compiler. By default the ClassLoader will be the system ClassLoader, which might not contain the Compiler.
-rw-r--r--src/compiler/Compiler.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/Compiler.java b/src/compiler/Compiler.java
index ed57398..6b446cc 100644
--- a/src/compiler/Compiler.java
+++ b/src/compiler/Compiler.java
@@ -2,6 +2,7 @@ package com.googlecode.prolog_cafe.compiler;
import com.googlecode.prolog_cafe.lang.BufferingPrologControl;
import com.googlecode.prolog_cafe.lang.ListTerm;
import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologClassLoader;
import com.googlecode.prolog_cafe.lang.PrologException;
import com.googlecode.prolog_cafe.lang.SymbolTerm;
import com.googlecode.prolog_cafe.lang.Term;
@@ -97,6 +98,7 @@ public class Compiler {
/** Initialize a new compiler instance. */
public Compiler() {
pcl = new BufferingPrologControl();
+ pcl.setPrologClassLoader(new PrologClassLoader(Compiler.class.getClassLoader()));
options = EnumSet.noneOf(Option.class);
enableDefaultOptions();
}