Paul Totzke Paul Totzke - 1 year ago 86
C# Question

Porting entire Java projects to to C#

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."

Answer Source

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-all-options", "run-sharpen.xml" and "header.txt" to the root of the project folder. Edit 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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download