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.
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 @@ 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 @@ /** Initialize a new compiler instance. */ public Compiler() { pcl = new BufferingPrologControl(); + pcl.setPrologClassLoader(new PrologClassLoader(Compiler.class.getClassLoader())); options = EnumSet.noneOf(Option.class); enableDefaultOptions(); }