Run a Java library

Use Java classes in JavaScript

1. Include CheerpJ on your page

<script src=""></script>

2. Initialize CheerpJ and load your Java library


This will load library.jar from the root of your web server.

3. Call Java from JavaScript

let obj = await cjNew("com.library.MyClass");
await cjCall(obj, "myMethod");

Further reading

Was this page helpful?
Suggest changes