Reputation: 3941
I found these two - Java Language Conversion Assistant and sharpen. But the first one depends on Visual Studio, the second on Eclipse.
I would prefer something standalone with command line if possible, even if very primitive.
Upvotes: 2
Views: 548
Reputation: 564631
In general, you'll find that any automatic Java->C# converter is going to be of marginal use, at best.
The problem isn't converting the language - that's fairly straightforward, and the converters do a reasonable job. The problem is in the framework itself. The Java class libraries and the .NET framework, although they support many of the same features, tend to have different ways of working at times, especially if you're targetting "modern" C#.
Java and C# were much closer together when C# was at 1.1. C# has differentiated itself more recently from Java, so this is getting tougher.
There is an updated JCLA that works with Visual Studio 2005, including the Express Editions, so you can get it for free. This will do a better job than the version you linked to previously.
Sharpen, the second option you listed, is probably the best, current option. (The Microsoft tool is VS 2003 only, and horribly out of date now.)
However, Sharpen, by default, will generate C# code that is, even in their terms, "somewhat alien looking" C#. You can do a lot by adding java doc comments to drive Sharpen, but frankly, it's probably easier to just port the code manually at this point.
Unfortunately, I don't know of any standalone command line programs that can do this. I suspect that JCLA could work by using Visual Studio automation and the command line, but I'm not sure what all would be involved.
Upvotes: 4