Results 1 to 5 of 5
  1. #1
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Default My program stops

    Hi,

    this is my java program.It executes pfe1.exe and pfe2.exe but it doesn't run the pfe3.exe
    the pfe1.exe and the pfe2.exe produce files that will be input for the pfe3.exe
    i want to know how can i solve my problem so that the pfe3.exe will be run

    Java Code:
    public static void main(String[] args) throws Exception
    	{
    		String[] env =  new String[] { "FOO_BAR=HelloWorld" };
    
    		Runtime.getRuntime().exec(new String[]{ "C:/Users/ACER/workspace/pfe/pfe1.exe" }, env);
    	        Runtime.getRuntime().exec(new String[]{ "C:/Users/ACER/workspace/pfe/pfe2.exe" }, env);
    	        Runtime.getRuntime().exec(new String[]{ "C:/Users/ACER/workspace/pfe/pfe3.exe" }, env);
           }

  2. #2
    mephistochen is offline Member
    Join Date
    May 2013
    Posts
    9
    Rep Power
    0

    Default Re: My program stops

    Are you sure the pfe3.exe program runs properly. Where is it from. Have you created it yourself. If yes can you post the source code?

  3. #3
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,507
    Rep Power
    5

    Default Re: My program stops

    Perhaps pfe3 can't find the file and is quietly dying. Where are the output files created? Where does pfe3 expect to find the input file?

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default Re: My program stops

    The exec( ... ) method returns a Process object. You can use it to wait until the process you have started has finished (read the API documentation for the Process class and pay special atttention to the waitFor() method). I suspect that the third process is started before the second one has finished.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Default Re: My program stops

    my pfe3.exe runs correctly.
    ok i will chek by waitFor()

    thanks

Similar Threads

  1. for loop stops working
    By name in forum New To Java
    Replies: 5
    Last Post: 04-17-2012, 04:53 PM
  2. While loop stops before told?
    By Naxix in forum New To Java
    Replies: 8
    Last Post: 07-08-2011, 07:24 AM
  3. Code stops for no reason
    By Bagzli in forum New To Java
    Replies: 9
    Last Post: 03-03-2011, 03:56 AM
  4. sound works then stops!
    By smileii in forum CLDC and MIDP
    Replies: 0
    Last Post: 09-26-2009, 12:06 AM
  5. Stops when opening ObjectInputStream
    By Norberhuis in forum Networking
    Replies: 4
    Last Post: 01-09-2009, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •