Calling java project from Mathematica

这一生的挚爱 提交于 2019-12-24 01:43:17

问题


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

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