See the discussion here:
Basically, you can’t embed a Java application in a website. You either have to use Processing.js or P5.js. This also means you can’t use Java-specific libraries.
You could export your sketch as an application and then allow users to download the application, but you can’t embed it directly in a webpage without using Processing.js or P5.js.