I have a java program that if you press a button, a python script with an argmument is executed. What I thought is: executing in the terminal pytho initConfig.py arg
.
This is my code:
String[] cmd = {"cd "+ System.getProperty("user.dir")+"/src/main/resources/", "python initConfig.py", getUser().getId()};
Process pb;
try {
pb = Runtime.getRuntime().exec(cmd);
String line;
BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
} catch (IOException e) {
e.printStackTrace();
}
And the error I´m getting is ´File not found´.
This is my folder structure:
project
src
main
java
com
controller
FileWhereTheButtonIs.java
resources
initConfig.py