Runtime.getRuntime().exec("cmd /c start file\\"+"My file.txt" ) Not work

Hello
i have a problem I use:
Runtime.getRuntime().exec("cmd /c start file\\"+"My file.txt");
to open "my file.txt" And I have error System Windows don't open file file\My becaus file My don't exist When I rename file to "Myfile.txt" and use:
Runtime.getRuntime().exec("cmd /c start file\\"+"Myfile.txt");
It's work great. My problem is when my file have space in name or other [ ], etc symbol. How fix this problem?
Thenks to help:)

Try using the verson where you specify the parameters in an array as this example shows:
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=635363
Note: you may need to enclose the file name in quotes

Similar Messages

  • Opening a new browser using Runtime.getRuntime().exec(cmd); under windows

    Can Runtime.getRuntime().exec(cmd); open a URL in to a new browser in wondows OS or ...can we force it to any specific browser insted on OS's default browser...
    It does open a new bowser under MAC but not under windows..
    cmd = "'rundll32 url.dll,FileProtocolHandler"+URL (windows)
    Thanks

    public class WindowsProcess
         public static void main(String[] args)
              throws Exception
              String[] cmd = new String[3];
              cmd[0] = "cmd.exe";
              cmd[1] = "/C";
              cmd[2] = "start";
              Process process = Runtime.getRuntime().exec( cmd );
              process = Runtime.getRuntime().exec( cmd );
    }When you run the above code you should get two open dos windows.
    Now just just enter some html filename and hit enter in each window. IE should start up separately in each window.
    Thats also what should happen if you specify the html file as the fourth parameter. A new process should be created and two separate windows should open with a browser in each.

  • Weird behaviour with Runtime.getRuntime.exec() attempting to start IE

    I have developed a sample scheduler that it a web page the user fill in and then create a process schedule by the Timer class. The process starts IE in order to automate data entry normally done by a user. The Java code run well but IE when start from the p = Runtime.getRuntime().exec() class freeze. Is anyone can tell if IE require special setting to run in background?
    Here the Java code but once again it work well but IE freeze and cause the forked process to hang.
    // The schedule task
    public void scheduleTask(Object o) throws ApplicationException {
    ScheduleBean sb = (ScheduleBean)o;
    try {
    Timer timer = new Timer(true);
    RunReslotting rr = new RunReslotting();
    timer.schedule(rr, sb.getSchedulingDate());
    catch(IllegalArgumentException iae) {
    throw new ApplicationException(iae.getMessage());
    catch(IllegalStateException ise) {
    throw new ApplicationException(ise.getMessage());
    public class RunReslotting extends TimerTask {
    protected RunReslotting() {
    public void run() {
    String[] cmdLineParam = transportProfile(2);
    cmdLineParam[0] = "location=" + wr.getLocation();
    cmdLineParam[1] = "loc_class=" + wr.getNewStrategy();
    forkProcess("runie.bat", cmdLineParam);
    private String[] transportProfile(int startAt) {
    envProf = System.getenv();
    profCmd = new String[envProf.size() + startAt];
    itr = envProf.entrySet().iterator();
    int i = startAt;
    while (itr.hasNext()) {
    entry = (Map.Entry)itr.next();
    profCmd[i] = (String)entry.getKey() + "=" + (String)entry.getValue();
    i++;
    return profCmd;
    private void forkProcess(String processName, String[] osParam) throws ApplicationException {
    // Lance un nouveau process
    p = null;
    int i=0;
    try {
    p = Runtime.getRuntime().exec(processName, osParam);
    // Vide les buffers du process pour eviter de geler
    mcError = new MessageCatcher(p.getErrorStream());
    mcOutput = new MessageCatcher(p.getInputStream());
    mcError.start();
    mcOutput.start();
    i = p.waitFor();
    if ( (i != 0) || (mcError.getMessage() != null) || (mcOutput.getMessage() != null) ) {
    System.err.println("*** Process failed RC:" + i + " *** ");
    if (mcOutput.getMessage() != null) {
    System.err.println("Output messages: " + mcOutput.getMessage());
    if (mcError.getMessage() != null) {
    System.err.println("Error messages: " + mcError.getMessage());
    throw new ApplicationException("*** Process failed *** ");
    catch(IOException ioe) {
    throw new ApplicationException(ioe.getMessage());
    catch(InterruptedException ie) {
    throw new ApplicationException(ie.getMessage());
    Any suggestion will be appreciate. I�m working on that scheduler for a while and i'm desperate
    Thanks
    Francis

    This starts IE for me, no problem
    String[] cmd = {"C:\\Program Files\\Internet Explorer\\iexplore.exe"};
    Runtime.getRuntime().exec(cmd);

  • Runtime.getRuntime().exec(cmd) not working

    I have created binary scrip to parse file from one format to another format and the file parser is available on Linux path and working fine when calling from command prompt but while calling this program from jsf or any any java form bean it adds some special charaters with program and throws IOException as belows
    calling command
    String[]     cmd={"delimiter",inputFile.toString(),outputFile.toString()};
    Process     p=Runtime.getRuntime().exec(cmd);
    it gives following error.
    java.io.IOException: delimiter@! : not found
    while calling this from jaav main application working fine.
    any suggestion would be appriciated.
    Cheers,
    dharmendra

    Thanks.
    I printed out whatever values are being passed and it is printing the right values on console and in log file and I also tried this command in stand alone application program an working fine. but when I call it from jsf form bean it adds ^@ at the end of first parameter and says ;
    IOException : delimiter^@ : not found
    i actually created the same copy as delimiter^@ and put it in same path directory with 777 mode.
    and now its working fine. but I did not know the reason why it change the name of first argument.
    Thanks,

  • Swign application and Runtime.getRuntime().exec(cmd)

    i want to use this program in a swing application, when i press the button it will execute this comand,?? is possible?
    String[] cmd = {"pwd","ls"};
    try {
    Process ls = Runtime.getRuntime().exec(cmd);
    BufferedReader input1 = new BufferedReader(new InputStreamReader(ls.getInputStream()));
    String str = input1.readLine();
    /* Keep looping until we have read all of the output */
    while(str != null) {
    System.out.println(str);
    str = input1.readLine();
    } catch (java.io.IOException el) {
    System.err.println(el);
    import javax.swing.*;
    import java.awt.event.*;
    public class Main{
    JFrame frame;
    public static void main(String[] args){
    Main db = new Main();
    public Main(){
    frame = new JFrame("Show Message Dialog");
    JButton button = new JButton("Click Me");
    button.addActionListener(new MyAction());
    frame.add(button);
    frame.setSize(400, 400);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public class MyAction implements ActionListener{
    public void actionPerformed(ActionEvent e){
    JOptionPane.showMessageDialog(frame,"hello");
    }

    its pretty hard to read without code tags,
    if your questions is can i use this code in my new swing applications when i press a button
    sure you can you need to make your new program with actionlisterners, your button will then wait until you click on it,
    then you will call your old method when the button is clicked
    I think that what you want sorry if i got the wrong end of the stick

  • GetRuntime().exec("chmod 777 a file.txt") - does not do the intended task

    Hi,
    I am trying to change the permissions of file (file name has spaces) using the Runtime.getRuntime().exec() method on AIX platform. My sample code is -
    import java.io.*;
    public class ChangeMode
         public static void main(String[] args)
              Process p = null;
         String cmd = null;
              cmd = "chmod " + "000" + " " + "a file.txt";
              try
              p = Runtime.getRuntime().exec( cmd );
              p.waitFor();
              catch( Exception e )
              e.printStackTrace();
              System.out.println("The exit value "+p.exitValue());
    In this case - I am getting exitValue of 2.
    But, the strange part is that - I am able to run the command
    "chmod 000 a file.txt "
    from the command prompt successfully.
    Any ideas what does an exitValue of 2 means and where is this program getting failed.
    Thanks!
    ~Saurabh

    Is 'a file.txt' the file name ?
    If I'm right, the Runtime.exec(String cmd) method will split the given string (using spaces.)
    The first token will be used a the command and the other ones as the arguments.
    In your example it will call chmod with three arguments: 000, a and file.txt
    In order to avoid that, you should either use the Runtime.exec(String[] cmd) method with: String[] cmd = new String[] {"chmod", "000", "a file.txt"};or try to put your file between ticks: String cmd = "chmod 000 'a file.txt'";You could have a look at this article to learn more about Runtime.exec() :
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    I hope it will help.

  • Runtime.getRuntime.exec(cmd) - 'out of space'

    And helpful suggestions from the Java / AIX boffins out there would be appreciated.
    System: AIX 4.3 jdk 1.3.1
    Briefly, I am attempting to invoke the ibm 'c' compiler from within a java program.
    The command:-
    p = Runtime.getRuntime.exec("/usr/ibmcxx/bin/cc test.c")
    returns the os error 'mmap failed: Not enough space'
    other commands that do work:-
    p = Runtime.getRuntime.exec("ls -l")
    return successfully without error
    p = Runtime.getRuntime.exec("/usr/ibmcxx/bin/cc Notfound.c")
    raises the error '/usr/ibmcxx/bin/cc 1501-288 input file NotFound.c not found' - as expected.
    Additionally:-
    I have tried invoking the program with the -msnnM & -mxnnM flags set to large values.
    /usr/ibmcxx/bin/cc test.c : works happily from the command line.
    cheers
    John.

    Thanks but not made any difference.
    keep those ideas coming!
    Does any body 'real' understand how the getRuntime() interacts with the underlying OS? I assume that the "mmap failed" is coming from the compiler rather then the JVM. But does it throw this error only when run through the JVM ?
    John.

  • Runtime.getRuntime().exec() in JSP - Starting a batch

    Hi,
    I am trying to start a batch from a jsp in the following way:
    try{
    String path = "bat/drucken";
    ProcessBuilder processBuilder = new ProcessBuilder(path);
    Process process = processBuilder.start();
    out.println("<script type=\"text/javascript\">alert('ausgeführt.');</script>");
    }catch(Throwable t){
    t.printStackTrace();
    out.println("<script type=\"text/javascript\"> alert('Fehler beim Drucken.');</script>");
    But onfortunately it does not work the way I want.
    If I double click the batch file, it works properly and starts a visual basic script, that makes out of n word-documents one single one.
    If I start it like above, then nothing happens and just the alert('ausgeführt') appears.
    How can I start a VB script or a commands of the shell from inside a jsp ?
    PS: using Windows XP, jsp should work on a Windows Server

    As Liane said, this should NOT be in your JSP. This should be in a normal Java file, compiled to a class, in a package, and deployed in the Web Application's /WEB-INF/classes/ directory.
    Example. Change the code to this:
    //Put your class in a package
    package debbie.in.florida;
    import java.io.*;
    public class Console{
        String error = null;
        String output = null;
        public String getError(){
            return error;
        public String getOutput(){
            return output;
        /** Called from inside the jsp like new Console().exec("cscript drucken.vbs param1 param2") **/
        public void exec(){
            try{
                String osName = System.getProperty("os.name" );
                String[] cmd = new String[3];
                cmd[0] = "cmd.exe" ;
                cmd[1] = "/C" ;
                cmd[2] = "Test.exe";
                Runtime rt = Runtime.getRuntime();
                System.out.println("Execing " + cmd[0] + " " + cmd[1] + " " + cmd[2]);
                Process proc = rt.exec(cmd);
                // any error message?
                grabStream(proc.getErrorStream(), "error");
                // any output?
                grabStream(proc.getInputStream(), "output");
                // any error???
                int exitVal = proc.waitFor();
                if (exitVal != 0)
                    error += "ExitValue: "+exitVal;
            } catch (Exception e){
                e.printStackTrace();
        private void grabStream(InputStream is, String msg){
            if (!(msg.equals("error") || msg.equals("output")))
                return;
            String message = "";
            try{
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null)
                    message += line;
            } catch (IOException ioe){
                ioe.printStackTrace();
            if (msg.equals("error"))
                error = message;
            else
                output = message;
    }Then compile the code and move the Console.class file to <web application>/WEB-INF/class/debbie/in/florida/Console.class. The folder should be debbie/in/florida because the package is defined as debbie.in.florida.
    Then your JSP would look like:
        <%//Use the debbie.in.florida namespace because your class is in a package
            debbie.in.florida.Console console = new debbie.in.florida.Console();
        %>
        <script type="text/javascript">
            alert("start");
        </script>
        <%
            console.exec();
            String error = console.getError();
            String output = console.getOutput();
        %>
        <script type="text/javascript">
            alert("end, output = <%=output%> and error = <%=error%>");
        </script>There is a lot wrong with this code, but I won't go and try to fix design problems here, That will be for a later day. But if things are working you should get two popups, one at the start, then your code should execute (or you should get an error message if something is wrong with the code), then a second popup at the end with the response from your application.

  • Runtime.getRuntime().exec problems

    i am trying to run files from my java application, i use the following command
    Runtime.getRuntime().exec("cmd /c start " + filePath);but it seems that it cant handle file path with spaces, like
    C:\Documents and Settings\Administrator\My Documents\My Web\Untitled-3.fla
    it works well with path like this
    C:\Downloads\1.rar
    am i right? and how to solve this problem? thanks

            final String[] command =
                "cmd.exe",
                "/C",
                "start \"" + filename + "\"",
            final Process p = Runtime.getRuntime().exec(command);this method can only trigger files in the same folder as the java application, isnt it?

  • Access denied when Runtime.getRuntime().exec

    I have an applet that opens a JFrame.
    In the JFrame I have a JButton, when I click the button I want a browser to open with a specific website.
    This doesn't work.
    When I look in the cmd-prompt it says:
    "java.security.AccessControlException: access denied (java.io.FilePermission C:\Program execute)"
    What have I done wrong? Do I have to change the security settings? Where do I that?
    class KnappListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    frame2 = new JFrame(e.getActionCommand());
    frame2.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    String website = new String("http://www.microsoft.com");
    try {
    Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.exe"+website);
    //Runtime.getRuntime().exec("cmd/C"+"start.exe"+website);
    catch (IOException io) {}
    }

    it doesn't matter which class your program extends. if your program is an applet (running in a browser) it is not permitted to use Runtime.getRuntime().exec(). If your program is an application, it is allowed to do so.
    I think there is a way for applets to get the permission through a policy, but I don't know how to do this.

  • Problem in Runtime.getRuntime().exec

    Hi,
    I am trying to start the tomcat server through a java application.Before starting the server,i need to run a batch file for setting up some classpaths.I am able to run the batch file and start the server,but its opening the 2 windows.How do i suppress it?
    One more problem is how do i stop the server?
    Code is:
    import java.io.*;
    public class Test
    public static void main(String args[]) {
    try {
         Process p = Runtime.getRuntime().exec("cmd /c start C:\\soap.bat");     
         p.destroy();
         Process p1 = Runtime.getRuntime().exec("cmd /c start C:\\jakarta-tomcat-3.2.1\\bin\\startup");
         //p.waitFor();     
         Thread.sleep(10000);
         p1.destroy();     
    BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
    bw.write("1");
    bw.flush();
    String line;
    while ((line = br.readLine()) != null) {
    System.out.println(line);
    br.close();
    bw.close();
    System.out.println(p.exitValue());
    catch(Exception e) {
    System.out.println(e);
    I need the help as early as possible.
    pls cc reply to:[email protected]
    Thanks
    Anitha

    Soln. to your first prob:
    1) To have the other DOS window closed, click on the extreme left-top corner of that window. In the menu that drops down ,select properties.In the properties window make sure the 'close on Exit' check Box is checked. Apply the changes.
    2) To stop the server u need to call the shutdown.bat file in the tomcat\bin dir. If u want to do this thru java then call the shutdown.bat file from your Runtime.exec() method. Same as u did for the startup file
    Hope this helps.

  • Strange behaviour of Runtime.getRuntime().exec(command)

    hello guys,
    i wrote a program which executes some commands in commandline (actually tried multiple stuff.)
    what did i try?
    open "cmd.exe" manually (administrator)
    type "echo %PROCESSOR_ARCHITECTURE%" and hit enter, which returns me
    "AMD64"
    type "java -version" and hit enter, which returns me:
    "java version "1.6.0_10-beta"
    Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b25)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b12, mixed mode)"
    type "reg query "HKLM\SOFTWARE\7-zip"" returns me:
    HKEY_LOCAL_MACHINE\SOFTWARE\7-zip
    Path REG_SZ C:\Program Files\7-Zip\
    i wrote two functions to execute an command
    1) simply calls exec and reads errin and stdout from the process started:
    public static String execute(String command) {
              String result = "";
              try {
                   // Execute a command
                   Process child = Runtime.getRuntime().exec(command);
                   // Read from an input stream
                   InputStream in = child.getInputStream();
                   int c;
                   while ((c = in.read()) != -1) {
                        result += ((char) c);
                   in.close();
                   in = child.getErrorStream();
                   while ((c = in.read()) != -1) {
                        result += ((char) c);
                   in.close();
              } catch (IOException e) {
              return result;
         }the second function allows me to send multiple commands to the cmd
    public static String exec(String[] commands) {
              String line;
              String result = "";
              OutputStream stdin = null;
              InputStream stderr = null;
              InputStream stdout = null;
              // launch EXE and grab stdin/stdout and stderr
              try {
                   Process process;
                   process = Runtime.getRuntime().exec("cmd.exe");
                   stdin = process.getOutputStream();
                   stderr = process.getErrorStream();
                   stdout = process.getInputStream();
                   // "write" the parms into stdin
                   for (int i = 0; i < commands.length; i++) {
                        line = commands[i] + "\n";
                        stdin.write(line.getBytes());
                        stdin.flush();
                   stdin.close();
                   // clean up if any output in stdout
                   BufferedReader brCleanUp = new BufferedReader(
                             new InputStreamReader(stdout));
                   while ((line = brCleanUp.readLine()) != null) {
                        result += line + "\n";
                   brCleanUp.close();
                   // clean up if any output in stderr
                   brCleanUp = new BufferedReader(new InputStreamReader(stderr));
                   while ((line = brCleanUp.readLine()) != null) {
                        result += "ERR: " + line + "\n";
                   brCleanUp.close();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              return result;
         }so i try to execute the commands from above (yes, i am using \\ and \" in java)
    (1) "echo %PROCESSOR_ARCHITECTURE%"
    (2) "java -version"
    (3) "reg query "HKLM\SOFTWARE\7-zip""
    the first function returns me (note that ALL results are different from the stuff above!):
    (1) "" <-- empty ?!
    (2) java version "1.6.0_11"
    Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
    Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
    (3) ERROR: The system was unable to find the specified registry key or value.
    the second function returns me:
    (1) x86 <-- huh? i have AMD64
    (2) java version "1.6.0_11"
    Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
    Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
    (3) ERROR: The system was unable to find the specified registry key or value.
    horray! in this version the java version is correct! processor architecture is not empty but totally incorrect and the reg query is still err.
    any help is wellcome
    note: i only put stuff here, which returns me strange behaviour, most things are working correct with my functions (using the Runtime.getRuntime().exec(command); code)
    note2: "reg query "HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0" /t REG_SZ" IS working, so why are "some" queries result in ERR, while they are working if typed by hand in cmd.exe?

    ok, i exported a jar file and execute it from cmd:
    java -jar myjar.jar
    now the output is:
    (1) "" if called by version 1, possible to retrieve by version 2 (no clue why!)
    (2) "java version "1.6.0_10-beta"
    Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b25)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b12, mixed mode)"
    (3) C:\Program Files\7-Zip\
    so all three problems are gone! (but its a hard way, as i need both functions and parse a lot of text... :/ )
    thanks for the tip, that eclipse changes variables (i really did not knew this one...)

  • Unable to execute Runtime.getRuntime().exec(

    Hello,
    I am new to Java programming and trying to execute (OS is Linux) an external jar File with the command:
    Runtime.getRuntime().exec("nohup java -jar SeismicAgents.jar &");It should start the SeismicAgents.jar and write the output to nohup.out.
    This works perfectly if I just enter the command at the command line.
    But upon starting it from within my program, the process seems to be started (I can see it when executin "ps aux"), but it is obviously not running as no input is written to nohup.out and the file which SeismicAgents.jar should generate is not generated.
    I also tried the following code:
    String cmd[] = {"nohup", "java", "-jar", "SeismicAgents.jar", "&"};
    Runtime.getRuntime().exec(cmd);But I am experiencing the same problem here.
    Executing something like
    Runtime.getRuntime().exec(ls);works without problems...
    Can anyone help?

    Runtime.getRuntime().exec("nohup java -jar
    SeismicAgents.jar &");Java does not interprete the '&' character. Neither does
    nohup. You would have to prefix this with /bin/sh -c, put
    the rest in quotes and, most importantly, redirect input
    and output somewhere. Without redirection, it is the task
    of your java program to feed the subprocess with input
    and drain its stdout and stderr buffers.
    Executing something like
    Runtime.getRuntime().exec(ls);works without problems...It is hard to believe this. Either it should be "ls" or
    ls is string variable containing the relevant string,
    but even then I would be surprised if you see any
    output on the command line. At least I don't get
    anything with public class bla {
      public static void main(String[] argv) throws Exception {
        Runtime.getRuntime().exec("ls");
    }If you don't want a "/bin/sh -c" hack, you may want to
    try http://www.ebi.ac.uk/~kirsch/monq-doc/monq/stuff/Exec.html .
    Harald.

  • Problems with Runtime.getRuntime().exec in Windows 2000

    Hello,
    I have a batch file that I want to run from my java application. My code is the following:
    try {
            Runtime.getRuntime().exec("cmd.exe /c C:\\temp\\shortcut.bat");
    } catch (Exception e) {
         System.out.println(e.getMessage());
    }I was developing on windows XP and it worked just fine. But then I tested it on windows 2000 and it didn't work. The batch file is okay, because if I run the batch file myself it works just fine, even from the command line. I get no errors what so ever, it just doesn't do anything...
    Can somebody help me with this?
    thx in advance

    thank you all so much
    I figured it out... It was a combination of two things that went wrong.
    First one: in my batch file I had:
    cd C:\tempwhich worsk fine in XP, but in it doesn't in 2000. In 2000 it has to be:
    C:
    cd \temp But just changing that wasn't enough, I also needed the "start"
    Now it works just fine on 2000, hopefully it'll still work on xp as well.
    THX!

  • Runtime.getRuntime().exec(...) problems and exit codes

    Hi,
    I am trying to launch an application 4 times with different arguments from a Java app. I have tried doing it sequentially and in four different threads, but the results are the same: sometimes the 4 of them are properly launched, sometimes (the most of the times) only 3 are launched and sometimes only 2. I have tried with cmd and cmdarray[] as parameters for exec but the results are the same.
    This is one of the four threads I use:
    Runnable r1 = new Runnable(){
                        public void run(){
                             String ecgCommand = "./flute -S -m:" + Config.ECGS_FLUTE_IP + " -p:" + Config.ECGS_FLUTE_PORT + " -F:" + Config.ECGS + " -r:" + Config.ECGS_FLUTE_RATE + " -C";
                             System.out.println(ecgCommand);
                             InputStream ecgsStream = null;
                             InputStreamReader isr = null;
                             BufferedReader br = null;
                             try{
                                  ecgsProcess = Runtime.getRuntime().exec(ecgCommand, null, new File(Config.HOME_PATH + Config.FLUTE_PATH));
                                  String line;
                                  ecgsStream = ecgsProcess.getInputStream();
                                  isr = new InputStreamReader(ecgsStream);
                                  br = new BufferedReader(isr);
                                  StyledDocument styleDoc = mm.ecgFluteMessages.getStyledDocument();
                                  Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
                                  while((line = br.readLine()) != null && running){
                                       if(styleDoc.getLength() > 25000)     mm.ecgFluteMessages.setText("");
                                       styleDoc.insertString(styleDoc.getLength(), line+ "\n", def);
                                       mm.ecgFluteMessages.setCaretPosition(mm.ecgFluteMessages.getDocument().getLength());
                                  System.out.println(ecgsProcess.waitFor());
                             }catch(Exception e){
                                  try {
                                       br.close();
                                       isr.close();
                                       ecgsStream.close();
                                  } catch (Exception e1) {
                                       e.printStackTrace();
                   new Thread(r1).start();Adding a Thread.sleep between runnables doesn't have any effect.
    In addition, those processes that are not properly launched return an exit value of 255. I have searched for its meaning but I have found nothing. Could anybody tell me where can I find a list of the JVM exit codes in order to guess what is happening?
    Can anybody help me with this issue? Help is much appreciated.
    Thanks a lot

    I have been looking for it but it seems it has not any exit code list or any documentation regarding this. Anyway, I think 255 is a JVM error code (the last one, errors are numbered in modulo 256) which means that the error has nothing to do with JVM but with the application execution (flute in my case).
    I have added a prompt for the errorStream and I have this message for the 255 exited programs:
    not well-formed (invalid token) at line 15+
    And the four commands are like this:
    *./flute -S -m:239.255.255.253 -p:60102 -F:./ecgs -r:150 -C*
    *./flute -S -m:239.255.255.252 -p:60103 -F:./ads -r:150 -C*
    *./flute -S -m:239.255.255.251 -p:60104 -F:./pushvod -r:50 -C*
    *./flute -S -m:239.255.255.250 -p:60105 -F:./banners -r:150 -C*
    So, as the process is sometimes initialized properly and others it is not, it seems that there is a problem with the tokenizing of the command not happening always. As I have tried it with a single command line and with an array of command strings (the first for "./flute" and the followings for each argument) with the same results I can't understand why is this problem happening sometimes. Happening always would help me in giving a clue but that's not the case.
    Any idea? Thanks a lot.
    Edited by: dulceangustia on Apr 3, 2008 3:41 AM

Maybe you are looking for

  • Smartform of a particular employee with dynamic actions

    Hi All, I am making an HR smartform - pulling data from infotypes  - so I am using logical database pnp. Now Everytime I enter the personal number in the PNP screen, it gives me form with correct data of respective employee. I want to club this smart

  • How to change the Apple ID associated with an iPhone4s

    My husband has bought my daughter a new iPhone 5s to replace her iPhone 4s which she has handed on to me, in to which we have now installed a new SIM. We have created a new Apple ID in my name but now need to change the Apple ID on the 4S handset to

  • Utf-8 encoding of SOAPPartImpl

    The XML Document I am trying to send in a SOAP response contains an E with an accent (comes from a UTF-8 Oracle db). On JDK 1.3.1_01 on Win2K, when I do not set -Dfile.encoding (it defaults to ISO-8859-1) - the webservices throws an exception that th

  • Dreamweaver Studio 8 on MacBook Pro

    Hello, I just bought a new Intel Based Mac and a brand spanking new, $1000 copy of Studio 8 but when I try to run Dreamweaver I get a pop up box that says: 65016 Nothing more. Fireworks from the package runs just fine. What's going on? Did I just blo

  • MBA not talking to iMac 24"

    Hi everyone, I'm trying to set up my new MBA by migrating things from my 24" iMac. I followed all the instructions in the manual, but no luck. So i continued the setup and tried to use the migration assistant, still no luck. I tried to go on the net