py5_tools.add_jars()#

Add all of the Java jar files contained in a directory and its subdirectories to the classpath.

Examples#

1import py5_tools
2
3py5_tools.add_jars('path/to/project_jars')
4py5_tools.add_classpath('path/to/jar/file/java_code.jar')
5
6import py5
7
8py5.println(py5_tools.get_classpath())

Description#

Add all of the Java jar files contained in a directory and its subdirectories to the classpath. The path can be absolute or relative. If the directory does does not exist, it will be ignored.

When import py5 is executed, add_jars('jars') is called for you to automatically add jar files contained in a subdirectory called jars. This is similar to functionality provided by the Processing IDE.

After the JVM has started, the classpath cannot be changed. This function will throw a RuntimeError if it is called after the JVM has already started. Use py5_tools.is_jvm_running() to first determine if the JVM is running.

Syntax#

add_jars(path: Union[Path, str]) -> None

Parameters#

  • path: Union[Path, str] - path to directory containing jar files

Updated on September 11, 2021 16:51:34pm UTC