Monday, August 30, 2010

How to install GCJ: GNU Compiler for Java?

In Windows world, there is no single GCJ installation.exe that installs GCJ.

GCJ exists inside Cygwin. So we have to install Cygwin. Detailed Step here:

Cygwin contains many components. It is not a good idea to install all and fill up the harddisk. How to decide which one to install?

My feeling is, choose only those components needed.

For example, I am clear that I want to use gcj ( GNU Compiler for Java ). So in the Cygwin-setup Search box, I type in “java” keyword. I choose only Devel/gcc-java.

The good thing is, when I click Next button, all the dependencies will be automatically chosen. Hence only the minimum set of components will be downloaded and installed.

When I am using gcj, along the way I’ll hit additional error, e.g. “cannot find…” missing libraries.

Error Message:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -liconv
collect2: ld returned 1 exit status

Then, I’ll launch Cygwin-setup again to install the missing library.

Keyword to install: