Another question in quick succession, but it should be a really obvious mistake that I do not see. I wrote the code to run the batch file below, but I get an error message saying that he cannot find the file, but I can assure that the file exists in the directory!
public class Pull { public void pullData() throws IOException { ProcessBuilder pb = new ProcessBuilder("adb.bat"); File f = new File("C:\\"); pb.directory(f); Process p = pb.start(); } public static void main(String[] args) throws IOException { Pull pull = new Pull(); pull.pullData(); }
}
and here is the error message
Exception in thread "main" java.io.IOException: Cannot run program "adb.bat" (in directory "C:\"): CreateProcess error=2, The system cannot find the file specified
java batch-file processbuilder
Rookie
source share