Fast, Expert Software Consulting and Programming HelpTM
Mips2Java GCJ / Applet / Win32 Port
Overview
If I told you that you could take sources for a C console application and convert them to 100% Pure Java code that can be hosted in an unsigned applet, would you believe me?
This is an informal port of Mips2Java to Win32 and gcj. The necessary makefiles, scripts and sources have been patched so that:
- either gcj or javac can be used to compile the runtime and your sources.
- either Cygwin bash or MSYS can be used on Win32 to build the Mips2Java runtime. (Only Cygwin can be used to build the MIPS cross compiler, however.)
- the runtime supports hosting within a Java applet
The Win32 bundle also provides prebuilt binaries for the Win32 Cygwin to MIPS cross compiler.
Mips2Java is licensed under the GNU
Public License.
There's also an instructive sample which should help get you started.
What Is Mips2Java?
Mips2Java is a way to translate C/C++ code to 100% Pure Java code. The presence of "MIPS" in the name is somewhat misleading, as the end result is 100% Pure Java code which has no dependency on the MIPS processor.
For full details, see the Mips2Java website.
"Why Did You Do This?"
Three reasons:
- to give Win32 developers access to Mips2Java
- to allow gcj to be used instead of javac
- to allow C applications to be hosted within a Java applet
The last point was the most compelling one for me. Whereas the designers of Mips2Java tout the ability to convert libjpeg and FreeType to Java code, I was intrigued by the possibility of taking a C console application, compiling it to 100% Pure Java and hosting it in an unsigned Java applet.
A cool demo of this can be found below.
Lookie Here!
Here is an unsigned applet which should run in any web browser with Sun's browser plugin installed. (This won't work under Microsoft's Virtual Machine.) The sample is part of the download bundle. Sun's plugin is installed when you install the Java Runtime Environment. The applet is running a C console application which I wrote in 1988 when I first started learning C:
Note: After you type "END", the applet will cease to respond to user input since the console application has "exited". To restart the "application", refresh your browser.
If your behind a firewall, you can run the application standalone:
- Download eliza.jar
- Type java -cp eliza.jar Mips2JavaEliza
The Bundles
Select the appropriate bundle for your platform. The Win32 bundle contains the prebuilt cross compiler binaries whereas the Linux / UNIX bundle only contains the runtime patches and sample applications.
After downloading the bundle, consult thisiscool-mips2java/ReadMe.txt for full instructions.
Win32 Bundle
thisiscool-mips2java-win32-20031222.zip
(21 315 616 bytes)
(MD5 checksum: 8a1db33b741f047874d8cf8ffca1b874)
Linux / UNIX Bundle
thisiscool-mips2java-posix-20031222.zip
(54 138 bytes)
(MD5 checksum: d636822a784c4757c691ecb6ed612f2c)
If You Enjoy This...
Would you consider visiting the following websites?: