Rustici Software recently completed development of a tool which automatically
converts C# to Java (which we geeks are calling "CS2J" for now). CS2J operates
at the source code level to provide a full and faithful representation of the
original C# source code in Java. To our knowledge, CS2J is the only fully
functional source code level tool for C# / Java conversion. The resultant Java
source code is human readable with a style that mimics the original C# code.
Why this Tool?
Rustici Software sells its SCORM Engine component to Learning Management System
software vendors. While most of these clients use the Microsoft platform, many
of our customers also run on Linux or other non-Microsoft platforms. Since the
SCORM Engine is an integral component in our customers' software, tight
integration, transparent source code access, optimal performance and
unencumbered distribution are all very important. CS2J allows us to:
Maintain a single set of C# source code for our application but support
deployment on any platform
Produce professional, clean and accurate Java code that mimics the style of the
original C# code
Continue to develop using Microsoft Visual Studio and the rest of our existing
development environment
Provide full source code to our customers on both the .Net and Java platforms
Customize the translation from C# to Java to meet our application's particular needs
Optimize the resultant Java source code to achieve highly performant solutions
(and include those optimizations in future conversions)
Automatically run source code conversion in our nightly build script
Distribute our application without paying per server royalties on the
translated code (as other vendors expect)
How it Works
The tool works by parsing the C# source code into a generic syntax tree. The
.Net library calls are then extracted from the syntax tree and converted into
their Java equivalent. Where equivalent Java translations are not available,
custom methods may be inserted. The translator provides full access to provide
custom library translations to optimize the conversion of individual
applications. After the syntax tree has been fully translated, a pretty printer
outputs the resultant Java source code.
Interested in Using CS2J?
We're currently throwing around ideas for releasing CS2J to the public. We are
considering include licensing it, offering conversion as a
service and releasing it as an open source product. If you have a need to
convert C# to Java, please use the form below to introduce yourself. We'd love
to hear from you and discuss how we might be able to help.