java-bridge
    Preparing search index...

    Class Java

    The main java class. This should only be created once per process. Any other attempts to create a new jvm instance will fail.

    Index

    Constructors

    • Create a new JVM instance.

      Parameters

      • libPath: undefined | null | string

        The path to jvm.(dll|so|dylib)

      • version: undefined | null | string

        The JVM version to use.

      • opts: undefined | null | string[]

        The JVM options to use.

      • javaOptions: undefined | null | JavaOptions
      • javaLibPath: string
      • nativeLibPath: string

      Returns Java

    Accessors

    • get classLoader(): object

      Returns object

    • set classLoader(classLoader: object): void

      Parameters

      • classLoader: object

      Returns void

    • get loadedJars(): string[]

      Get the loaded jars.

      Returns string[]

    • get version(): string

      Get the actual JVM version. This may not match the wanted JVM version.

      Returns string

    • get wantedVersion(): string

      Get the wanted JVM version. This may not match the actual JVM version.

      Returns string

    Methods

    • Append a single or multiple jars to the classpath.

      Parameters

      • classpath: string | string[]

      Returns void

    • Parameters

      • classname: string
      • methods: Record<
            string,
            (
                err: null | Error,
                callback: (err: null | Error, data?: any) => void,
                ...args: any[],
            ) => void,
        >
      • Optionaloptions: null | internal.InterfaceProxyOptions

      Returns internal.JavaInterfaceProxy

    • Parameters

      • obj: object

      Returns void

    • Import a java class Will import the class and parse all of its methods and fields. The imported class will be cached for future use.

      Parameters

      Returns object

    • Import a java class (async) Will return a promise that resolves to the class instance.

      If the underlying Java throwable should be contained in the error object, set asyncJavaExceptionObjects to true. This will cause the JavaScript stack trace to be lost. Setting this option in the global config will not affect this method, this option has to be set each time this method is called.

      Parameters

      Returns Promise<object>

      importClass

    • Check if this is instance of other

      Parameters

      • thisObj: object
      • other: string | object

      Returns boolean

    • Set the stdout/stderr callbacks

      Parameters

      • OptionalstdoutCallback: null | ((err: null | Error, data?: string) => void)
      • OptionalstderrCallback: null | ((err: null | Error, data?: string) => void)

      Returns StdoutRedirect