Porting entire Java projects to to C#

﹥>﹥吖頭↗ 提交于 2019-12-23 15:49:32

问题


I'm looking for a free way to convert entire Java projects to C#. I followed Pauldb's article on using Sharpen in eclipse. The tutorial is a bit outdated.

While using Luna on Windows I got the following errors:

After trying to update the references to work on my enviroment I get

...\run-sharpen.xml:59: The following error occurred while executing this line:
...\run-sharpen.xml:20: exec returned: 13

In which the log file says "java.lang.RuntimeException: Application "sharpen.core.application" could not be found in the registry."


回答1:


Step 1: Download eclipse Mars (I'm using 4.5.0)

Step 2: Open Eclipse. Import your project and use a src/ folder for all your java files.

Step 3: Add the files "sharpen.properties", "sharpen-all-options", "run-sharpen.xml" and "header.txt" to the root of the project folder. Edit sharpen.properties to fit your enviroment. In run-sharpen.xml, comment out these lines as they are examples for dependencies:

<arg value="-cp" />
<arg path="C:/eclipse/workspace/myproject/libs/kxml2-2.3.0.jar" />
<arg value="-cp" />
<arg path="C:/eclipse/workspace/myproject/libs/regexp-me.jar" /> 

Step 4: Help > Install new software > Find and add "Eclipse 2.0 Style Plugin Support" and "Eclipse e4 Tools Developer Resources" (or just search "Eclipse Tests, Tools, Examples, and Extras" and add all)

Step 5:: Use ngit's sharpen.core jar file and place it into your "eclipse/plugins" folder.

Step 6: mlink your "/Program%20Files/" to be "/Program Files/" I believe this is a bug in Mars. This prevents "org.eclipse.swt.win32.win32.x86_64_3.104.0.v20150528-0211.jar" cannot be found error (even when it exists).

Step 7: Run the Ant file in eclipse. It should tell you it compiled. Otherwise it will give you a link to

Step 8: Sharpen does a pretty good job but there will be errors. If an error is too common, edit "sharpen-all-options" and re-run.


Notes: I couldn't get this to work in Luna after too many hours of trying. Updated to Mars and it had different problems that I could fix. It wouldn't recognize ""sharpen.core.application" could not be found in the registry". Updating to mars seems to fix it.

Link to example github project



来源:https://stackoverflow.com/questions/31418484/porting-entire-java-projects-to-to-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!