Java Runtime exec() not working
问题 I try to execute a shell command via java like this if (Program.isPlatformLinux()) { exec = "/bin/bash -c xdg-open \"" + file.getAbsolutePath() + "\""; exec2 = "xdg-open \"" + file.getAbsolutePath() + "\""; System.out.println(exec); } else { //other code } Runtime.getRuntime().exec(exec); Runtime.getRuntime().exec(exec2); but nothing happens at all. When I execute this code it prints /bin/bash -c xdg-open "/home/user/Desktop/file.txt" in the console, but does not open the file. I have also