First, download the following software:
1 http://sourceforge.net/projects/mingw/
MinGW-5.1.3.exe
2 http://sourceforge.net/projects/gnuwin32/
Libiconv-1.9.2-1-bin.zip
Libiconv-1.9.2-1-lib.zip
The above is the latest version at that time. With the latest version, please select the latest version to download.
Installation 2
1. To install mingGW, You must select the following options:
Mingw-runtime
Mingw32-make
Gcc-java
By default.
2. Install libiconvand decompress libiconv-1.9.2-1-bin.zipand libiconv-1.9.2-1-lib.zip to the mingGW installation directory.
3. Preparation Environment
1. Add the bin directory of minggw to the path system variable;
2. To compile a java program using gcj, You need to block the jdk environment variables. To avoid affecting the normal use of jdk, write the following bat and name it j2e. bat for backup:
@ Echo off
Set CLASSPATH =
Gcj-c % 1. java-o % 1.o
Gcj -- main = % 1-o unzip 1.exe % 1.o
3. Write a java class with the following content:
Public class Hello
{
Public static void main (String [] args) throws Exception
{
System. out. println ("Hello exe4j ");
}
}
4. Compile:
Run j2e hello, and the program generates hello.exe. Check carefully and find that the file is large, because he has packaged the jre.
5 deployment:
Is it okay to take this hello.exe ?? No. You must also bring libiconv2.dll. Do not forget.