How can I compile a Java application’s class files into a standaloneexecutable file without using a commercial native code compiler and atthe same time keep it platform independent?
The simple answer is that you cannot do that. By compiling Javabyte code to operating system binaries, you create aplatform-dependent program. The only way to keep your Javaapplications platform-independent is to keep them in byte code form.
With the progress being made in just-in-time (JIT) compilation, thereis little need to compile your Java programs into native executables.However, natively compiled Java still leads JIT Java in performancebenchmarks.
If you need platform independence, distribute yourapplication as class files, otherwise you’re going to have to compilethe program for ever platform you want to run on.