I have been trying to access the modeller program written in python programming language with my Java code. But I am unable to do so. I have tried accessing the .py file , the .exe file, using jython but still no success. The jython is helping access certain classes not the entire program.
Plz help.
I have tried this code but its giving me some stupid errors which i cant fix.
Plz help...
import java.io.*; // run this way // javac JavaRunCommand.java // java -classpath . JavaRunCommand public class JavaRunCommand { public static void main(String args[]) { String st = null; try { String[]callAndArgs= {\"python\",\"my_python.py\",\"arg1\",\"arg2\"}; Process p = Runtime.getRuntime().exec(callAndArgs); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output while ((s = stdInput.readLine()) != null) { System.out.println(s); } // read any errors while ((s = stdError.readLine()) != null) { System.out.println(s); } System.exit(0); } catch (IOException e) { System.out.println(\"exception occured\"); e.printStackTrace(); System.exit(-1); } } }
Thankx in Advance... :)
The precise error messages would help people to answer.
Did you have a look at Jython?