java -jar twitie_tag.jar <path to model file> <path to input file> <output file>
I have given the above command in java process builder like given below
ProcessBuilder pb = new ProcessBuilder("java","-jar","twitie_tag.jar","models\\gate-EN-twitter.model", "newfile.txt");
pb.redirectErrorStream(true);
final Process process = pb.start();
InputStream stderr = process.getInputStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
process.waitFor();
System.out.println("Waiting ...");
System.out.println("Returned Value :" + process.exitValue());
but it is throwing an error as Exception in thread "main"
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
if i give redirectoutputstream it is not prining anything it is just printing waiting and the exit value is 1
i have a jar file twittejar and i executed in command line as java, -jar, twitie_tag.jar, gate-EN-twitter.model, newfile.txt, > outfile.txt (output will be saved in outfile.txt). if i give java, -jar, twitie_tag.jar, gate-EN-twitter.model, newfile.txt (the output will be shown in that command window itself) but i need to execute theses commands using java program.