Cannot Execute Program Error=26
Hello everyone I am working on an update function for a project that I've been working on, I can send the update perfectly fine but when it tries to execute it I get the following error:
Code :
java.io.IOException: Cannot run program "/home/josh/Desktop/MmrghClient/Mmrgh.jar": error=26, Text file busy
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.Runtime.exec(Runtime.java:615)
at java.lang.Runtime.exec(Runtime.java:448)
at java.lang.Runtime.exec(Runtime.java:345)
at newbi3.payloads.Execute.runProgram(Execute.java:12)
at newbi3.Mmrgh.getUpdates(Mmrgh.java:88)
at newbi3.Mmrgh.connect(Mmrgh.java:77)
at newbi3.Mmrgh.main(Mmrgh.java:25)
Caused by: java.io.IOException: error=26, Text file busy
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
... 7 more
I have made the file executeable and I am running Ubuntu 10.04 if that is of any help.
Here is some snippets of code for you
Code :
public void getUpdates() {
if (config.DEBUG_MODE)
System.out.println("Out of date attempting to update...");
FileReceiver.startRecieving();
System.out.println(FileReceiver.file.getAbsolutePath());
if (FileReceiver.file.exists()) {
FileReceiver.file.setExecutable(true); // This makes it executeable
Execute.runProgram(FileReceiver.file.toString()); // This is where I am getting the error
} else
System.out.println("File does not exist.");
if (config.DEBUG_MODE)
System.out.println("Updated successfully!");
System.exit(0);
}
Code :
public static void runProgram(String path) {
try {
Runtime.getRuntime().exec(path); // This should be executing it
} catch (Exception e) {
if (Mmrgh.config.DEBUG_MODE)
e.printStackTrace();
}
}
Re: Cannot Execute Program Error=26
Java jar's aren't really stand-alone "executable programs". Rather, they're an archive which the Java Runtime has a pre-defined method for executing Java programs from.
You need to run the Java program by passing the jar to the java executable:
Re: Cannot Execute Program Error=26