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.

2 Likes

Thank you @Wasabi375
Can you give me some examples?

Please read the documentation on multiplatform development: https://kotlinlang.org/docs/reference/multiplatform.html. 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.