This is in reference to this question from Math SE: here.

Is there a way to import Java code into Mathematica? I'm looking for either:

  1. A conversion utility
  2. A method of manually converting
  3. A way for me to at least implement, edit, and run the code without having to learn Java.

My main objective would be to have a definite method of converting code like from the answer to this question (here) to a Mathematica notebook as I know how to work with Mathematica and have a raspberry pi, but don't know Java. What's the best way to do this? Or, if there's not a simple conversion method, what would the code be? Are there certain things I can look for in Java that correspond to things in Mathematica, or would the conversion require a high knowledge of both codes inner workings?


  • 2
    $\begingroup$ There's no way to convert it automatically. You can either 1) implement the same algorithm described in the Math.SE answer (this will run much slower than Java) or 2) use J/Link to call the Java program from Mathematica. Asking people to convert the code is not appropriate for this site ... $\endgroup$ – Szabolcs May 17 '16 at 19:11
  • $\begingroup$ Ok, thank you. I'll try J/Link out. That's really what I was looking for: a) a conversion utility, b) a method of manually converting, or c) a way for me to at least implement the code, edit, and run without learning Java. $\endgroup$ – Elem-Teach-w-Bach-n-Math-Ed May 17 '16 at 19:18
  • $\begingroup$ Well, you'll need to learn at least a little bit of Java to use J/Link, but not much. I know next to zero Java but I did use J/Link for small things a few times. $\endgroup$ – Szabolcs May 17 '16 at 19:25
  • 2
    $\begingroup$ This maybe useful. $\endgroup$ – xslittlegrass May 17 '16 at 21:02
  • $\begingroup$ Instead of closing, perhaps @Szabolcs's comment could be an answer. This seems like a question others might want to know the answer to, even if it is negative (or half-positive if you think J/Link is a solution). $\endgroup$ – Michael E2 May 17 '16 at 22:54

Browse other questions tagged or ask your own question.