I am trying to execute a .py file from java code. I move the .py file in the default dir of my java project and I call it using the following code:
String cmd = "python/";
String py = "file";
String run = "python " +cmd+ py + ".py";
System.out.println(run);
//Runtime.getRuntime().exec(run);
Process p = Runtime.getRuntime().exec("python file.py");
Either using variable run, or the whole path or "python file.py" my code is running showing the message build successful total time 0 seconds without execute the file.py. What is my problem here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…