GCJ

Compiling Java to native code using GCJ 2

neutr1n02001's picture

I've successfully compiled a simple SWT program using GCJ on MingW. I'm glad it works, but I still feel a bit unsure about GCJ. First, there's not much activities in the past few years. Some of the documentation on the GCJ and GNU Classpath web sites seem to be out-of-date. The mailing lists are quiet. I guess there are not many people interested in compiling Java into machine code. Who can blame them, It's not easy to use GCJ. I myself have to refresh my skills on GCC tool chain first.

Also maybe the demand is just not there. From what I know, the modern Just in Time virtual machines have quite good performance already. The dynamic compiling they do at run time can provide extra optimization than the traditional static compiling. But the performance on JIT virtual machines are not consistent. They are usually very slow at the beginning, then gradually improves when more and more byte code are compiled into native code. So for a real-time program, native compiled code is still more suitable. The problem is, how many people use Java in a real time programming project? Most of the time, Java is used in back end enterprise applications. In these kinds of enterprise environments, performance issues are solved by architecture (adding more hardware). Remember, some of the J2EE vendors are also selling hardware.

Compiling Java to native code using GCJ

neutr1n02001's picture

I've been researching ways to improve the performance of my Java programs. One technology is called ahead-of-time compiling, which is to compile Java source code directly to native machine code. The GCJ, the GNU Compiler for the Java is such a tool.

All my Java programs are GUI code using SWING. Unfortunately, GCJ doesn't support SWING/AWT yet. But SWT works with GCJ. And there is a library called SWINGWT, which is SWING implemented on SWT. So here's a potential easy way to convert my Java programs to small and fast native code. There are quite a few other benefits as well, such as, hard to reverse-engineering, easy to deploy, no need for end users to pre-install Java run time.

Google Ads

Syndicate content