问题
Could you please give me a hint how can I invoke a java project (written in eclipse) from Mathematica? I want to give values generated by my Mathematica program as input to a java project, and use the (outputs) results obtained from solving the problem by java, as input to my Mathematica code. I know there is a J/Link package for calling java from mathematica. But, i don't know how I can have this interaction between them.
回答1:
Assuming your project is on the class path, you can pull in Java pretty easily(see docs)
Needs["JLink`"];
InstallJava[];
awesomeClass = LoadJavaClass["my.java.class.OfAwesomeness"];
awesomeClass`crazyStaticMethod[];
awesomeInstance = JavaNew[awesomeClass,"Awesome Arg 1"];
awesomeInstance@superCoolMethod[1,2,3];
来源:https://stackoverflow.com/questions/2176697/calling-java-project-from-mathematica