I want to execute a Python script (including Scipy and Numpy) from Java which should be bundled with the tomcat project by eclipse. Calling Python from Java is trivial:
Runtime.getRuntime().exec("python ...");
How can I achieve bundling the script to call it at the corresponding path? Is this even possible?
解决方案
I did some thing similar recently , i am able to run it from eclipse.
i kept both the jars(jython.jar and plyjy.jar) in lib folder of the Eclipse project and copied the required python files to the src folder of the project.
Then created an Python Object Instance using the following code
PySystemObjectFactory factory = new PySystemObjectFactory(InterfaceTye, moduleName,ClassName);
with the help of factory object we can create an object of the specified module and call the methods of that particular module.
I was able to achieve it only in eciplse, but i am not sure how to bundle the same for the build