When you first download and install the MinGW Java compiler (gcc-java), you may find that when you try to compile a Java program with gcj, you get an error saying "cannot find -liconv". This is because gcj automatically attempts to link your program with libiconv, which is not distributed with MinGW and must be downloaded and installed separately. To get your Java program to compile, download libiconv from http://gnuwin32.sourceforge.net/packages/libiconv.htm. You want "Binaries" and "Developer files". Unzip both downloaded files to your MinGW directory.
You should now be able to successfully compile a Java program. You might try the following as an example. Type this code into a file named Test.java:
public class Test
{
public static void main(String args[])
{
System.out.println("This is a test.");
}
}
Now compile it:
gcj --main=Test Test.java
There should now be a file named a.exe in the directory where you compiled the program. Run it and you should get the following output:
This is a test.
Re: Compile with gcj
Why does this point to the GnuWin32 implementation of libiconv, when we do, in fact, provide our own?
https://sourceforge.net/project/showfiles.php?group_id=2435&package_id=67879
Files:
libiconv-1.11-1-bin.tar.bz2
libiconv-1.11-1-dll.tar.bz2
libiconv-1.11-1-src.tar.bz2
Re: Compile with gcj
It was a direct copy from the old wiki. There are more than one reference to gnuwin32 that needs to change throughout this documentation.
Re: Compile with gcj
I thought it would be something like that; thanks for the confirmation.
Issues like this do highlight that that some packages, currently grouped into the MSYS Supplementary Tools collection, really deserve a more general exposure; libiconv would seem to be one such.