How can I compile a JVM lib to works on JS and native?

How is that possible to make a JVM lib to run on native or JS?

If you mean a third party library that you want to use: it’s not.
You will have to find similar libraries for each platform and write a multiplatform wrapper around them or find a kotlin multiplatform library that fits your needs.


Thank you @Wasabi375
Can you give me some examples?

Please read the documentation on multiplatform development: There are quite a lot about it actually.

The only way to create native images from JVM libraries is GraalVM (Substrate plugin). There are some attempts to traspile java to JS, but there are not stable.