[ NOTE: Since November 2015, it is no longer open source, so this hack is mostly useless. ]
RoboVM may be the solution you are looking for. It is open source and compiles JVM bytecode (.class files) into machine code.
I assume they do this using something like class2llvm.
Unfortunately, he is still in alpha. I just tested it on HelloWorld.java. This gave a 5x faster boot time running on a single core. (Most of the execution time is load time.)
echo Hello World! : <1 ms : 31K echo Hello World! : <1 ms : 31K (/ usr / bin / echo binary)
java HelloWorld : ~70 ms : 0.4K (JVM HelloWorld.class bytecode)
./HelloWorld : ~13 ms : 9.4MB (9.3MB binary + 57K robovm-rt.jar)
Note that java calls the 32MB file $ JAVA_HOME / lib / rt.jar (and possibly more). Searching in such a large file should be part of the reason java loads so slowly. If RoboVM gets smarter, maybe it can throw away most of the 9.3 MB binary for even faster downloads?
The site mentions iOS, but I think that since they are selling their additional user interface libraries. RoboVM has collected a fine for me for the taste of Ubuntu. Just be sure to do
$ sudo apt-get install g ++ - multilib
first (and maybe install libpthread-stubs0-dev and libpthread-workqueue0 ... I don't know if they mattered).
expz Nov 15 '14 at 3:13 2014-11-15 03:13
source share