Access Java executables and resources directly from the Wolfram Language.

Using Static Methods...

Load the J/Link package

Load the J/Link package using Get (<<):

Launch Java

Launch the local Java runtime with InstallJava:

Set the class path

Use AddToClassPath to append a file that contains Java classes to the Java class path:

  • By default, AddToClassPath will search relative to $HomeDirectory for files. You can also specify an absolute file path or a directory to search.

Load a class

Load a Java class from the program into the Wolfram kernel using LoadJavaClass:

Call methods

You can now use static methods and fields in the class directly in computations:

Using a Class Instance...

Load the J/Link package

Load the J/Link package using Get (<<):

Launch Java

Launch the local Java runtime with InstallJava:

Set the class path

Use AddToClassPath to append a file that contains Java classes to the Java class path:

  • By default, AddToClassPath will search relative to $HomeDirectory for files. You can also specify an absolute file path or a directory to search.

Create a class instance

Make a new instance of a class using JavaNew:

Call methods

You can now use methods and fields from this instance directly in computations:

Notes

For a full explanation of J/Link capabilities, refer to the J/Link User Guide.