I know that there is a lot of similar questions, but neither solved my problem...
So, I would like to execute python script from java using ProcessBuilder...
Here is a method which I wrote and which does not work:
public void stemPosts(String scriptPath, String inputFile, String outputFile)
throws IOException {
ProcessBuilder process = new ProcessBuilder("python", scriptPath,
inputFile, outputFile);
process.start();
}
And here is method call (<user_path>
is just to hidden personal info):
dataManager.stemPosts(
"D:/<user_path>/stemmer/Croatian_stemmer.py",
"D:/<user_path>/stemmer/posts.txt",
"D:/<user_path>/stemmer/stemmedPosts.txt");
First parameter is script, second parameter is first script parameter (inputFile) and third parameter is second script parameter (outputFile)...
Execution in cmd is simple: python Croatian_stemmer.py posts.txt stemmedPosts.txt
and that works...
Code above only creates output file but it does not fill it with data...
I tried changing file separators and it did not help...