I am trying to develop a Java tool to refactor css files. I am trying to access the command prompt from Java. The command prompt is opening fine but it's not running the csstidy exe file.
try {
String command = "cmd /c start cmd.exe /K \"cd C:/Users/BS11040/Desktop/CSSTIDY_JAVA/";
Process child = Runtime.getRuntime().exec(command);
OutputStream out = child.getOutputStream();
out.write("csstidy.exe /r/n".getBytes());
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
Try invoking your .exe directly, you are doing it way to complicated:
And by the way, the codes for CR and NEWLINE are
\n
and\r
, take care to use the right slash!