So I have a sh script which is located in my Downloads folder. Using this script I managed to open the terminal at the specific folder:
String command = "/usr/bin/nome-terminal.wrapper"; File workDir = new File("/home/user/Downloads"); Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(command, null, workDir) And than I wanted to run the script after the terminal was loaded so I replaced the script above with this:
String command= "/usr/bin/nome-terminal.wrapper -e 'myScript.sh; bash'"; File workDir = new File("/home/user/Downloads"); Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(command, null, workDir) But the error I get is: here was an error creating the child process for this terminal. Failed to execute child process “'myScript” (No such file or directory)
Note: I don't want to run the script directly. I want the terminal to run it
UPDATE
I tried using this :
String[] cmdArray = new String[2]; cmdArray[0] = "usr/bin/gnome-terminal.wrapper"; cmdArray[1] = "myScript.sh"; Process process = Runtime.getRuntime().exec(cmdArray, null,new File("/home/user/Downloads")); but I get the error: java.io.IOException: Cannot run program "usr/bin/gnome-terminal.wrapper" (in directory "/home/user/Downloads"): error=2, No such file or directory as he tries to find the terminal exe inside my Downloads folder.
/usr/bin/gnome-terminal.wrapperin every instance. That's probably not the whole problem but try fixing the obvious typos. There's a slash as the first character and agafter the last slash. (There should be no need to type out the full path if it's in yourPATH, per se.)