Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Cannot Execute Program Error=26

  1. #1
    Join Date
    Jan 2011
    Thanked 0 Times in 0 Posts

    Default 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:

    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

    public void getUpdates() {
    		if (config.DEBUG_MODE)
    			System.out.println("Out of date attempting to update...");
    		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!");

    public static void runProgram(String path) {  
    		try {
    			Runtime.getRuntime().exec(path); // This should be executing it
    		} catch (Exception e) {
    			if (Mmrgh.config.DEBUG_MODE)

  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Thanked 619 Times in 561 Posts
    Blog Entries

    Default 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:

    java -jar jar_file

  3. The Following User Says Thank You to helloworld922 For This Useful Post:

    frozen java (September 27th, 2012)

  4. #3
    Join Date
    Jan 2011
    Thanked 0 Times in 0 Posts

    Default Re: Cannot Execute Program Error=26

    Thanks this works!

Similar Threads

  1. how to execute multiple different queries in one execute?
    By Sakina in forum JDBC & Databases
    Replies: 1
    Last Post: June 9th, 2012, 09:40 AM
  2. Unable to execute the program (no compilation error)
    By Alexie91 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 16th, 2011, 02:39 PM
  3. What's wrong. Compile Ok but error when execute.
    By hantuapi in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 1st, 2011, 05:33 AM
  4. What's the damn error in this program...
    By bsudhir6 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 12th, 2010, 07:57 AM
  5. How to execute a Java program independent of Netbeans.
    By ShaunB in forum Java Theory & Questions
    Replies: 4
    Last Post: January 19th, 2010, 05:23 AM

Tags for this Thread