Search in sources :

Example 1 with IncompatibleJarException

use of org.strategoxt.IncompatibleJarException in project spoofax by metaborg.

the class StrategoRuntimeService method loadJars.

private void loadJars(HybridInterpreter runtime, Iterable<FileObject> jars) throws MetaborgException {
    try {
        final URL[] classpath = new URL[Iterables.size(jars)];
        int i = 0;
        for (FileObject jar : jars) {
            final File localJar = resourceService.localFile(jar);
            classpath[i] = localJar.toURI().toURL();
            ++i;
        }
        logger.trace("Loading jar files {}", (Object) classpath);
        final ClassLoader classLoader = new StrategoRuntimeClassLoader(additionalClassLoaders);
        runtime.loadJars(classLoader, classpath);
    } catch (IncompatibleJarException | IOException | MetaborgRuntimeException e) {
        throw new MetaborgException("Failed to load JAR", e);
    }
}
Also used : MetaborgRuntimeException(org.metaborg.core.MetaborgRuntimeException) IncompatibleJarException(org.strategoxt.IncompatibleJarException) MetaborgException(org.metaborg.core.MetaborgException) FileObject(org.apache.commons.vfs2.FileObject) IOException(java.io.IOException) File(java.io.File) URL(java.net.URL)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 URL (java.net.URL)1 FileObject (org.apache.commons.vfs2.FileObject)1 MetaborgException (org.metaborg.core.MetaborgException)1 MetaborgRuntimeException (org.metaborg.core.MetaborgRuntimeException)1 IncompatibleJarException (org.strategoxt.IncompatibleJarException)1