<p>Is there an effective tool to convert C# code to Java code?</p>

[{'answer_id': 78860, 'author': 'scubabbl', 'author_id': 9450, 'author_profile': 'https://Stackoverflow.com/users/9450', 'pm_score': 2, 'selected': False, 'text': '<p>They don\'t convert directly, but it allows for interoperability between .NET and J2EE.</p>\n\n<p><a href="http://www.mainsoft.com/products/index.aspx" rel="nofollow noreferrer">http://www.mainsoft.com/products/index.aspx</a></p>\n'}, {'answer_id': 78928, 'author': 'Roger Ween', 'author_id': 6143, 'author_profile': 'https://Stackoverflow.com/users/6143', 'pm_score': 3, 'selected': False, 'text': '<p>There is a tool from Microsoft to convert java to C#. For the opposite direction take a look <a href="http://www.cs2j.com/" rel="nofollow noreferrer">here</a> and <a href="http://www.theserverside.com/news/thread.tss?thread_id=40344" rel="nofollow noreferrer">here</a>. If this doesn\'t work out, it should not take too long to convert the source manually because C# and java are very similar, </p>\n'}, {'answer_id': 78943, 'author': 'Michael Meadows', 'author_id': 7643, 'author_profile': 'https://Stackoverflow.com/users/7643', 'pm_score': 6, 'selected': False, 'text': '<p>I have never encountered a C#->Java conversion tool.  The syntax would be easy enough, but the frameworks are dramatically different.  Even if there were a tool, I would strongly advise against it.  I have worked on several "migration" projects, and can\'t say emphatically enough that while conversion seems like a good choice, conversion projects <em>always always always</em> turn in to money pits.  It\'s not a shortcut, what you end up with is code that is not readable, and doesn\'t take advantage of the target language.  speaking from personal experience, assume that a rewrite is the cheaper option.</p>\n'}, {'answer_id': 79138, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>C# has a few more features than Java.  Take delegates for example: Many very simple C# applications use delegates, while the Java folks figures that the observer pattern was sufficient.  So, in order for a tool to convert a C# application which uses delegates it would have to translate the structure from using delegates to an implementation of the observer pattern.\nAnother problem is the fact that C# methods are not virtual by default while Java methods are.  Additionally, Java doesn\'t have a way to make methods non virtual.  This creates another problem: an application in C# could leverage non virtual method behavior through polymorphism in a way the does not translate directly to Java.\nIf you look around you will probably find that there are lots of tools to convert Java to C# since it is a simpler language (please don\'t flame me I didn\'t say worse I said simpler); however, you will find very few if any decent tools that convert C# to Java.</p>\n\n<p>I would recommend changing your approach to converting from Java to C# as it will create fewer headaches in the long run.  Db4Objects recently released their internal tool which they use to convert Db4o into C# to the public.  It is called Sharpen.  If you register with their site you can view this link with instructions on how to use Sharpen:\n<a href="http://developer.db4o.com/Resources/view.aspx/Reference/Sharpen/How_To_Setup_Sharpen" rel="nofollow noreferrer">http://developer.db4o.com/Resources/view.aspx/Reference/Sharpen/How_To_Setup_Sharpen</a></p>\n\n<p>(I\'ve been registered with them for a while and they\'re good about not spamming)</p>\n'}, {'answer_id': 287113, 'author': 'Gad', 'author_id': 25152, 'author_profile': 'https://Stackoverflow.com/users/25152', 'pm_score': 1, 'selected': False, 'text': '<p>I\'m not sure what you are trying to do by wishing to convert C# to java, but if it is .net interoperability that you need, you might want to check out <a href="http://www.mono-project.com/Main_Page" rel="nofollow noreferrer">Mono</a></p>\n'}, {'answer_id': 287125, 'author': 'Ian Patrick Hughes', 'author_id': 2213, 'author_profile': 'https://Stackoverflow.com/users/2213', 'pm_score': 1, 'selected': False, 'text': '<p>This is off the cuff, but isn\'t that what <a href="http://dev.mainsoft.com/Default.aspx?tabid=130#What%20is%20Grasshopper?" rel="nofollow noreferrer">Grasshopper</a> was for?</p>\n'}, {'answer_id': 436025, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>Try to look at <a href="https://net2java.dev.java.net/index.html" rel="nofollow noreferrer">Net2Java</a> It seems to me the best option for automatic (or semi-automatic at least) conversion from C# to Java</p>\n'}, {'answer_id': 1222523, 'author': 'Mike Rustici', 'author_id': 115553, 'author_profile': 'https://Stackoverflow.com/users/115553', 'pm_score': 5, 'selected': False, 'text': '<p>We have an application that we need to maintain in both C# and Java. Since we actively maintain this product, a one-time port wasn\'t an option. We investigated Net2Java and the Mainsoft tools, but neither met our requirements (Net2Java for lack of robustness and Mainsoft for cost and lack of source code conversion). We created our own tool called <a href="http://www.cs2j.com" rel="noreferrer">CS2J</a> that runs as part of our nightly build script and does a very effective port of our C# code to Java. Right now it is precisely good enough to translate our application, but would have a long way to go before being considered a comprehensive tool. We\'ve licensed the technology to a few parties with similar needs and we\'re toying with the idea of releasing it publicly, but our core business just keeps us too busy these days.</p>\n'}, {'answer_id': 1222542, 'author': 'Hannoun Yassir', 'author_id': 72443, 'author_profile': 'https://Stackoverflow.com/users/72443', 'pm_score': 1, 'selected': False, 'text': '<p>Well the syntax is almost the same but they rely on different frameworks so the only way to convert is by getting someone who knows both languages and convert the code :) the answer to your question is no there is no "effective" tool to convert c# to java</p>\n'}, {'answer_id': 2613269, 'author': 'Nick Westgate', 'author_id': 313445, 'author_profile': 'https://Stackoverflow.com/users/313445', 'pm_score': 3, 'selected': False, 'text': '<p>This blog <a href="http://lpeer.blogspot.com/2010/04/switching-from-c-to-java.html" rel="noreferrer">post</a> suggests useful results from <a href="http://www.tangiblesoftwaresolutions.com/" rel="noreferrer">Tangible</a>.</p>\n'}, {'answer_id': 3138658, 'author': 'Guven Demir', 'author_id': 378740, 'author_profile': 'https://Stackoverflow.com/users/378740', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.tangiblesoftwaresolutions.com/" rel="noreferrer">These</a> guys seem to have a solution for this, but I haven\'t tried yet. They also have a demo version of the converter.</p>\n'}, {'answer_id': 4434677, 'author': 'Pavel Savara', 'author_id': 129124, 'author_profile': 'https://Stackoverflow.com/users/129124', 'pm_score': 1, 'selected': False, 'text': '<p>Possibly you could use <a href="http://jni4net.sf.net/" rel="nofollow">jni4net - opensource bridge</a> instead ?\nOr list of <a href="http://jni4net.sourceforge.net/links.shtml" rel="nofollow">other options</a> I know.</p>\n'}, {'answer_id': 4682675, 'author': 'Big Rich', 'author_id': 304330, 'author_profile': 'https://Stackoverflow.com/users/304330', 'pm_score': 3, 'selected': False, 'text': '<p>Although this is an old-ish question, take a look at xmlVM <a href="http://www.xmlvm.org/clr2jvm" rel="nofollow">http://www.xmlvm.org/clr2jvm</a>, I\'m not sure if it\'s mature enough yet, although it has been around for several years now. XMLvm was made, I believe, primarily for translating Android Java apps to the iPhone, however, its XML-code-translation-based framework is flexible enough to do other combinations (see the diagrams on the site).</p>\n\n<p>As for a reason to do this conversion, maybe there is a need to \'hijack\' some of the <a href="http://code.google.com/codesearch?hl=en&amp;lr=&amp;q=license%3absd|apache|mit|zlib+lang%3ac%23+game&amp;sbtn=Search" rel="nofollow">highly abundant oss code</a> out there and use it within his/their own [Java] project.</p>\n\n<p>Cheers</p>\n\n<p>Rich </p>\n'}, {'answer_id': 32242667, 'author': 'Rohitdev', 'author_id': 569691, 'author_profile': 'https://Stackoverflow.com/users/569691', 'pm_score': -1, 'selected': False, 'text': '<p>Why not write it in Haxe (<a href="http://haxe.org/" rel="nofollow noreferrer">http://haxe.org/</a>) and convert it to whatever you want it to be?</p>\n'}]
['https://Stackoverflow.com/questions/78811', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']