views:

513

answers:

3

I heard that JNBridge will translate C# code to native Java code.( I haven't tested it).

Is there any tool available in market to translate Java code to native C# ?(or Will JNBridge also translate Java code to C# ?)

+5  A: 

Are you talking about a source code converter, or the ability to run Java code in a CLR?

If it's the latter, you might want to look at IKVM:

IKVM.NET is an implementation of Java for Mono and the Microsoft .NET Framework. It includes the following components:

  • A Java Virtual Machine implemented in .NET
  • A .NET implementation of the Java class libraries
  • Tools that enable Java and .NET interoperability
Jon Skeet
A: 

I don't think that direct "code translating" could be possible, what with invoking API functions? (like, each technology has it's own collections, etc.). Link that you have given, doesn't seem to be code translator, rather - libraries that allows one to connect components, like embedding java GUI inside WPF app etc.
Also, on the main page of JNBridge, they are writing:

Bridge anything Java to .NET
Bridge anything .NET to Java

So it might a good idea to check someone's site before asking about possibilities of their platform.

Ravadre
+1  A: 

Microsoft's Visual Studio 2005 included a Java to C# conversion tool (the Java Language Conversion Assistant). Although they announced in 2007 it wouldn't be developed further (and it isn't in VS 2008) it is still a supported product until 2015.

Daniel Earwicker
And IIRC it only worked with Java 1.1...
Jon Skeet