I'm not sure how can I compile my Java code to wasm using CheerpJ compiler.
In the documentation all I can find is how to compile it to Javascript file, but it should be able to compile it to wasm as well. Can anyone help me with the command.
CheerpJ lead developer here. CheerpJ does uses WebAssembly internally for parts of the Java runtime. It does not use WebAssembly as a compilation target for Java bytecode.
The reason for this is that WebAssembly is just not a good target for Java, while JavaScript is. CheerpJ generates very efficient JavaScript by using type hints and making sure all objects have a well-known structure that never changes.