Java to C# Converter

本文介绍了一款名为Java2CSharpTranslatorforEclipse的免费工具,该工具作为Eclipse插件,可将Java项目转换为C#项目。文章详细描述了插件的下载、安装过程及使用方法,并给出了积极的使用反馈。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在许多工程环境下要求把现有的Java项目转换成C#形式。手工操作显然是低效率的,是否存在现成的转换工具呢?


微软的VS2005(至高是这个版本提供了一个上述转换工具,简称为JLCA 3.0)。以后,微软便不再支持了,我尝试下载(http://www.microsoft.com/download/en/confirmation.aspx?id=14349),但是在VS2008和VS2010下都无法 安装!!!这真是一个遗憾!


还有其他的,但是大多是商业性的,价格在$100以上。

我最近在研究一些JAVA程序,但是由于对JAVA语法没有全面的把握,所以想找一个JAVA TO CSHARP工具,结果并没有发现多少。相反,其他的语言转换工具,特别是在线免费的,倒是不少。

我现在发现的两款免费的JAVA TO CSHARP工具有:

(1) Sharpen, position: http://msforums.ph/forums/t/48263.aspx

(2)Java 2 CSharp Translator for Eclipse, at sourceforge https://sourceforge.net/apps/mediawiki/j2cstranslator/index.php?title=HowToUse

简单地搜集了一些材料,其中提到Sharpen是命令行式的,而且有许多细节需要配置,便干脆不理它,而是直奔后者。

如名所示,Java 2 CSharp Translator for Eclipse是一款Eclipse插件。这个插件的下载与安装非常简单。

下载


需要下载两个东西:

A. 插件本身,在https://sourceforge.net/projects/j2cstranslator/,不大,下载下来是一个1.19M的com.ilog.rules.Java2CSharpTranslator_1.3.6.20110331_01.jar。

B.映射库文件,这是另一个小小的SOURCEFORE项目,在https://sourceforge.net/projects/j2cstranslator/files/Mapping%20Library/DotNet%204.0/1.3.40.8_20110223_01/。因为我的环境是WINDOWS 7+.NET 4.0+ VS2010,所以当然要下载最新的 DotNet4.zip这个文件,是一个205KB的ILOG.J2CsMapping.dll。


安装

A.插件文件复制到ECLIPSE的插件文件夹下,我的是C:\eclipse\plugins。

B.映射文件放到哪里呢?你可以保存在原来的位置,但是直接复制到ECLIPSE根目录下最简单。因为后来的生成向导中会提问这个映射文件的所在位置,当然默认他会在ECLIPSE根目录下寻找。


使用

至于使用上述插件就比较简单了。打开ECLIPSE,选择File-Export,然后看下图:



接下来的几步不必细说了,因为同志们都是ECLIPSE用户。

效果

我的结论是转换效果相当不错!总体来看,这款 软件非常极时,而且操作非常易于上手,没有半点崩刮之处,干净利索。有需要的朋友赶紧试一试吧。
一个很强大的工具, 能将c#代码片段、文件甚至工程直接转换成java代码,并能彻底解决外部引用的DLL问题,最强的是支持c#工程的直接转换,生成的Java代码质量也很不错。软件已破解,去除了未注册版最多只能转换1000行的限制,亲测可用!压缩包内含帮助文档,不过由于软件的使用很简单,帮助文档基本可以忽略。(小提示:如无法运行,请确认是否安装了.NET framework) 下面是一些英文介绍: C# to Java Converter features include: 1. Folder conversion: Entire folders of C# code files are converted to Java code files.(文件夹转换) 2. Code snippet and file conversion: Our snippet conversion accuracy is outstanding and does not require you to insert entire methods or classes. Heuristics are used to convert code fragments wit h missing declarations. (代码片段和文件转换) 3. Full support for the latest .NET code syntax: Generics and other newer C# features are converted where possible to the Java equivalent.(全面支持最新版的.NET语法) 4. Conversion options: You can specify numerous conversion options via our Options dialog. Code formatting options, custom type & member replacements, custom string replacements, and miscellaneous options. (可以指定转换规则) 5. File comparison feature: After converting a project or folder, you can compare original and converted files side-by-side. Comparing converted code to original code.(原代码与转换后代码的比较) 6. Running from the command line: C# to Java Converter can be launched directly for a specific project, folder, or file conversion from the command line. Command line.(命令行执行) 其他一些特点: 1. Converts all versions of C# code (2002, 2003, 2005, 2008, and 2010) (可以转换所有版本的C#代码) 2. Evaluates all referenced assemblies and .NET projects in order to resolve external references more completely.(能彻底解决外部引用的dll类库) 3. Converts C# ref parameters using Java generics 4. Superb conversions of all types of arrays 5. Handles the numerous coding alternatives and ambiguities of C# code 6. Flawless conversion of all aspects of inheritance and interfaces 7. Allows custom replacement of strings in the final converted code 8. Accurate even with poorly formatted C# code
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值