I want to execute tabula tool commands,from within the java program. The code that I am trying is:
System.setProperty("user.dir", "C:\\Program Files");
String command ="\\tabula\\tabula-0.9.0-SNAPSHOT-jar-with-dependencies.jar "+"D:\\sample.pdf"+" -o "+"D:\\sampleeeee.csv";
Process p = Runtime.getRuntime().exec(command);
it is not working,any help would be appreciated. this command need to be executed from java
Try this to set the working directory where the command will run.
https://stackoverflow.com/a/8405745/1364747
Process p = null;
ProcessBuilder pb = new ProcessBuilder("java","-jar","tabula-0.9.0-SNAPSHOT-jar-with-dependencies.jar", "D:\\sample.pdf", "-o", "D:\\sampleeeee.csv");
pb.directory("C:\\Program Files\\tabula");
p = pb.start();