C2J, a C++ to Java translator

c2j is a C++ to Java translator that translates C++ code to Java code. The parser is written in C++, because I wrote it before I ever heard of Java... The input to c2j must consist of:

c2j is basically a shell-script that calls sed, a C++-to-Java translator, and the C pre-processor to do all the weaving of moving methods into one Java class definition.

This parser currently uses a shell script and a Unix utility called "sed". When you have access to Unix utilities on a Windows PC (like the MKS toolkit), the parser could also be used.

On UNIX, and Win95/WinNT use the following command to make the parser:


Different problems that are tackled by this parser:

c2j translates roughly about 85-95 percent of our code correctly. It saves me a lot of editing time (inlining all methods, translating simple types, removing &'s everywhere, changing -> into ., etc. Just run it and see what it does for you...

A beta version of c2j can be downloaded here for free.

We have decided to put this parser in the public domain. Use it at your own risk, and if you make any changes (especially improvements), tell us! We hope that this utility is useful for you and the rest of the C++/Java community.

Chris Laffra
Morgan Stanley, 750 Seventh Avenue (between 49 & 50), NYC, NY 10019
Email: laffra@ms.com, Tel: (212) 762 2223, Fax: (212) 762 0520