PDA

View Full Version : Platform specific compiling in Java?




Awesomeness
Apr 15, 2009, 04:26 PM
I am making an application specifically for Macs. I use the Jar Bundler application to turn it into an application. I need this program to run as fast as possible, and if the VM can do less interpreting of the jar it will run faster, or so I've heard. If this is true, are there any programs that compiles jars that overall run faster on macs than, say, your everyday javac?



garethlewis2
Apr 15, 2009, 04:35 PM
Your assumptions about Java are about 8 years out of date.

javac just converts Java source code into byte-code. It doesn't do any optimisation.

java takes this bytecode as either class files or as a jar of class files and then loads this into a hotspot VM. As it runs the classes, it will constantly analyse the usage of the classes and in doing so, will make decisions about how to optimise the code. It will always do this during the run-time of the program, so what you run, will be fastest code that can possibly be shipped. If need be, it will convert the byte code into raw machine code and execute that.

Awesomeness
Apr 15, 2009, 08:40 PM
I just searched on the internet, so I guess the page was out of date.