I needed to convert some Java code to C# and one of the best ways that I ever found is to use Sharpen
. This used to be available as a Eclipse plugin but you can find a cli version at Mono’s Github account:
One of the issues in running Sharpen is that it requires Java 1.7, NOT 1.6, nor 1.8..
So you need to have a Java 7 install. An easy way if you are already using homebrew, is available via a cask:
brew install Caskroom/versions/java7
Note: If you get errors, make sure that your casks are updated, brew upgrade brew-cask
Current JDK:
/usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
Get a list of Install JDKs:
ls -l1 /Library/Java/JavaVirtualMachines/
1.6.0.jdk
jdk1.7.0_71.jdk
jdk1.7.0_80.jdk
jdk1.8.0_92.jdk
Export a “new home”:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
Now I can build and run sharpen
, i.e.:
mvn clean test
mvn install
java -jar src/target/sharpencore-0.0.1-SNAPSHOT-jar-with-dependencies.jar /Users/sushi/github/PlayParser