Based on your post, I now have it working on Windows 11. The command line code is now in processing.exe and is different from MacOS; hence the use of processing.exe in lieu of processing-java.exe. Another difference is Windows uses back slashes in file paths instead of forward slashes like the Unix systems; therefore I had to change both newFileAction() and runAction() to use back slashes and use folderPath with sketch= in runAction(). Actually when used in a string in Windows you have to use double back slashes as shown below.
The runAction() that works on my system follows:
void runAction() {
String runFilePath = "";
String folderPath = "";
int selectedIndex = tabbedPane.getSelectedIndex();
for (int i = 0; i < files.size(); i++) {
String path = files.get(i);
if (i == selectedIndex) {
runFilePath = path;
println(path);
logArea.append("runAction : runFilePath = " + runFilePath + "\n");
}
}
int lastSlashIndex = runFilePath.lastIndexOf('\\');
if (lastSlashIndex != -1) {
folderPath = runFilePath.substring(0, lastSlashIndex);
logArea.append("runAction : folderPath = " + folderPath + "\n");
} else {
logArea.append("No path separator found.");
}
String sketchStr = "--sketch=" + folderPath;
logArea.append("Generated command: " + cmdStrExe + " cli " + sketchStr + " --run\n");
ProcessBuilder processBuilder = new ProcessBuilder(cmdStrExe, "cli", sketchStr, "--run");
try {
process = processBuilder.start();
BufferedReader stdIn = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader stdErr = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String outStr = "";
while ((outStr = stdIn.readLine()) != null) {
logArea.append(outStr + "\n");
println(outStr);
}
String errStr = "";
while ((errStr = stdErr.readLine()) != null) {
logArea.append(errStr + "\n");
}
// Wait for the process to complete and get its exit value
int exitCode = process.waitFor();
logArea.append("\nProcess exited with code: " + exitCode + "\n");
}
catch (IOException | InterruptedException e) {
logArea.append(e + "\n");
}
}
Output Windows11:
Any idea how to get that vertical scrollbar to not be clipped?
