Function getClassLoader

  • Get the addon's internal class loader. This may be used in combination with setClassLoader to create a custom class loader and load classes from it.

    Example

    import { getClassLoader, setClassLoader, importClass } from 'java-bridge';

    const classLoader = getClassLoader();

    const URLClassLoader = importClass('java.net.URLClassLoader');
    const URL = importClass('java.net.URL');

    // This actually happens internally when appendClasspath is called
    const newClassLoader = new URLClassLoader([new URL('file:///path/to/my.jar')], classLoader);

    setClassLoader(newClassLoader);

    Returns UnknownJavaClass

Generated using TypeDoc