开发者

Is there a Native Java AOT For Mac OSX?

开发者 https://www.devze.com 2023-02-11 21:43 出处:网络
I wonder if there is a AOT complier(s) for the Mac to compile Java apps into native executables, therefore eliminating the need for a JRE?

I wonder if there is a AOT complier(s) for the Mac to compile Java apps into native executables, therefore eliminating the need for a JRE?

I have seen commercial examples for both Windows and Linux but haven't been able to find anything for the Mac, other than the opensource GCJ which has limited success with some of the poplar java li开发者_如何学Pythonbraries.

A native executable for the Mac would rid it of the JRE and, possibly, allow it to be signed allowing Java developed applications to possibly be accepted into the app store.


Install4J can compile your Java into a native OS X application but the system still should have JRE installed. Install4J just creates a wrapper for a JRE call.


You can use the Avian JVM for this. (Wikipedia article).

You can compile your application to a standalone executable and it supports different class libraries: openjdk, the Android class library implementation (even if you are not running on Android), and a custom class library that is very limited (basically they add methods to it as the authors need APIs to run their own applications).

In the README in the code repository there is a description how to embed the VM and generate a "boot" C++ program that will run your application and refer to the section "bootimage" if you want to AOT compile all the methods and generate a binary image obviating the need for JIT compilation at runtime.

Without the boot image, you can ship the jar files and a executable that will "start" them (the executable will embed the virtual machine). With the boot image, the jar files will additionally be pre-compiled to native code.

On the other hand, if you just need a managed language/platform, you can also use .NET/Mono AOT. See the mkbundle tool included with Mono 2.x.

0

精彩评论

暂无评论...
验证码 换一张
取 消