importLib

Imports a Java class.

Overview:

Functions:

API Reference

importLib()

Returns the specified class if it exists.

var libLoader = importLib("library-name.jar");

Parameters:

  • className(String) Name of the class to import.

  • library-name.jar (String): The filename of the JAR library located inside the plugin’s libs folder.

    • The path is relative to the plugin’s directory, typically something like: plugins/openjs/Libs/library-name.jar


How It Works:

  • The library JAR is loaded at runtime, making all its public classes and resources available to your script.

  • After loading, you can use the returned loader object to get Java classes from the library, instantiate objects, and call methods.

  • This approach enables powerful extensibility by letting you integrate third-party Java libraries into your scripts.


Example:

In this example, the RiveScript chatbot Java library is loaded from the Libs folder, and its main class is instantiated for use in your script.

circle-exclamation

Important Notes

Last updated

Was this helpful?