if (mathArgs == null) {
throw new RuntimeException("wolfram.math.args must be defined");
}
/* Attempt to obtain a connection to a kernel */
KernelLink link = MathLinkFactory.createKernelLink(mathArgs);
link.discardAnswer();
link.enableObjectReferences();
/* Load the map-reduce API code */
loadPackageFromJar(link, "MapReduceAPI.m");
/* Register a shutdown hook to close this kernel */