Hi,

Iam new to java as iam working for dotnet C#.
Can any body tell me the software to convert java code to C#.
Please, iam in very much need for it.

Thanks in advance,
Anjali ...

Dani AI

Generated

Short answer for : there are tools that will translate Java into C#, but none do a perfect, production-ready job. The fastest, most reliable result comes from combining a mechanical converter (to scaffold and fix obvious syntax) with manual porting and testing. This echoes ’s caution about blindly trusting converters and ’s point that knowing C# (and learning the Java differences) makes the job far easier.

Practical options to try: a maintained commercial converter (Tangible Software Solutions’ “Java to C# Converter”) for quick, high‑quality scaffolding; the open-source Sharpen tool if you want an automated, configurable conversion pipeline (it’s archived and requires customization); IKVM.NET to avoid porting at all by running or compiling Java bytecode as .NET assemblies; and commercial bridging products (JNBridge, Javonet) when you prefer interoperability instead of source conversion. Microsoft’s old Java Language Conversion Assistant (JLCA) is no longer a recommended solution. (tangiblesoftwaresolutions.com)

A pragmatic porting workflow that’s worked repeatedly:

  • Decide: interop (IKVM/JNBridge) versus full port.
  • Run a converter to produce scaffolding.
  • Replace packages/imports → namespaces/usings; map core libraries (java.util → System.Collections.Generic, java.io → System.IO).
  • Fix language mismatches: generics, checked exceptions, equals()/hashCode(), serialVersionUID/serialization, inner and anonymous classes, threading and synchronization.
  • Add unit tests, run static analysis and profiling, then iterate until behavior and performance match expectations.

A tiny example of a common sync idiom to watch for:

/* Java */
synchronized (obj) {
    // ...
}

/* C# */
lock (obj) {
    // ...
}

For : study Sharpen’s mapping approach and IKVM’s bytecode-to-IL work to understand how converters handle library shims and generics. For everyone: use converters as time-savers, not final answers — always review, test, and refactor the output into idiomatic C#.

Recommended Answers

All 8 Replies

Who says there is any?

I find it extremely lazy of people to expect there to be software programs that will convert code from one language into code from another. Both languages will have there own idioms, syntax, and "way of doing things", and it is almost guaranteed (regardless of which 2 languages are involved) that a "converter" program would be able to create syntactically correct, and runtime efficient code.

I have seen converters for other languages, and although they created code that was syntactically correct, it was nothing I ever wanted to actually use.

IF you know C# then you will have little difficulty converting it to java on your own. It will not take you much time to read a few things about java. If you know C# you don't need to learn anything new, just understand a few things about how java works.
If you know C# and you didn't just find someone else's code and you want to convert it to java for your assignment.

IF you know C# then you will have little difficulty converting it to java on your own. It will not take you much time to read a few things about java. If you know C# you don't need to learn anything new, just understand a few things about how java works.
If you know C# and you didn't just find someone else's code and you want to convert it to java for your assignment.

Yeah I agree...

Knowing C# takes some fair Java and C language know-how, along with the idea of delegates, partial classes, unsafe context, "member variables," etc...

I been told that if you can get Java application running in Visual J++ VS2005 and VS2008 should do the conversion for you. Reality, I never try it, I love Java too much...:*

Thanks a lot, for suggestions.
I will try to convert it by myself. As it was in very much need and of short time , i thought about some software to convert.
Ya, i will shurly try to do it.

Thanks a lot,
Anjali ..

well what if some one is intrested in writting a module that could actually convert java to C#,
I have got an assignment to write such sw which i am afraid not as simple as its title suggests,,,
i will really appreciate if some one could give me some idea that what will be the starting point for this sw... plz mail me at , if any one of you have any idea how to do this

public String encrypt(String plaintext) throws Exception {
        MessageDigest md = null;

        md = MessageDigest.getInstance("SHA");

        md.update(plaintext.getBytes("UTF-8"));

        byte raw[] = md.digest();

        String hash = (new BASE64Encoder()).encode(raw);

        return hash;
    }
commented: Completely irrelevant post hijacking thread -1

What does that have to do with anything.

To ask a question, start a new thread.

Closing this thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.