2 ms·
If you wish to avoid JRE, you can use Graal VM and compile to native AOT executables. Just takes a few minutes to download and play-around. (Even timed it with
by lenkite 4y ago
If you wish to avoid JRE, you can use Graal VM and compile to native AOT executables. Just takes a few minutes to download and play-around. (Even timed it with another Java disbeliever here on HN)
https://www.graalvm.org/latest/reference-manual/native-image/ https://www.graalvm.org/latest/reference-manual/native-image...
- layer8 4y agoYou can’t use anything reflection-based I think.
- kaba0 4y agoYou can, you just have to have a config file that lists files that might get reflected upon. This is available for some of the more common libraries (there is definitely more work to do here), and you can also use an agent, run your code on a regular JVM and it will collect the runtime accesses and create that config file for you.
- circuit10 4y agoWhen I tried it the file size ended up way bigger than just packaging a JVM would be
- lenkite 4y agoThat isn't a general behaviour. You can get <5mb binary size for modest apps. Likely have one or two "bad" actors contributing to binary size. Try the Graal VM dashboard to identify which modules are bloating up the binary. "Use GraalVM Dashboard to Optimize the Size of a Native Executable" https://www.graalvm.org/latest/reference-manual/native-image/guides/use-graalvm-dashboard/ https://www.graalvm.org/latest/reference-manual/native-image... Tutorial that shows reducing binary size from 17MB to 862KB! https://docs.oracle.com/en/graalvm/enterprise/22/docs/reference-manual/native-image/guides/use-graalvm-dashboard/ https://docs.oracle.com/en/graalvm/enterprise/22/docs/refere...