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

Similar Messages

  • Runtime.getRuntime().exec() problem while getting Mozilla version.

    Hi all,
    I've trying to get the current mozilla version in Java side using
    Runtime.getRuntime().exec(). The sample code is as below.
    I've tested two cases using exec(), as case# 1 and case# 2.
    The result is after the code.
    try
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(new String[] {"mozilla", "-remote"}); //case# 1
    //Process proc = rt.exec(new String[] {"mozilla", "-version"}); //case# 2
    InputStream stderr = proc.getErrorStream();
    InputStreamReader isr = new InputStreamReader(stderr);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    System.out.println("<ERROR>");
    while ( (line = br.readLine()) != null)
    System.out.println(line);
    System.out.println("</ERROR>");
    int exitVal = proc.waitFor();
    System.out.println("Process exitValue: " + exitVal);
    } catch (Throwable t) {
    t.printStackTrace();
    // execute "mozilla -remote"(case# 1)
    $ java TestExec
    <ERROR>
    -remote requires an argument
    </ERROR>
    Process exitValue: 1
    // execute "mozilla -version"(case# 2)
    $ java TestExec
    <ERROR>
    </ERROR>
    Process exitValue: 0
    I'm just surprised that why case# 2 couldn't get the returned version string as case #1 ? Since there will be version string be returned from command line:
    $ mozilla -version
    Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830, build 2002083014
    Could anybody explain the problem or give any solution ?
    Thanks.
    -George.

    Hi all,
    One more question here.
    While I use Runtime.getRuntime().exec() to execute some commands,
    the commands may fail for some reason. Generally, they will return with the exit
    value set to 1 or others. But sometime, before waitFor() exits, there is a popped up
    dialog giving some info, and only after I click the "OK" button, it dispears, and
    waitFor() returns the exit value.
    So I'm not sure that could I suppress this popped up dialog, and make it run
    just like other commands ? I mean, just get the exit value by waitFor() without user
    interferance ?
    Thanks.
    -George.

  • Runtime.getRuntime().exec hangs and doesn't print the output

    Hi,
    I have written the following code to execute the command "psexec ipaddress -u userid -p password -l -c execute.exe >> c:/25_showoutpout.txt" and print the output in 25_showoutpout.txt file.
    import java.io.*;
    public class ExecTest{
         public static void main(String args[]) throws IOException{
         String args1 = "psexec ipaddress -u userid -p password -l -c execute.exe >> c:/25_showoutpout.txt";
         try{
         Process p=Runtime.getRuntime().exec(args1);
    int i = p.waitFor();
         System.out.println("Done.with time "+i);
         }catch(Exception e){
              System.out.println("The error is "+e);
    But this program hangs and creates a blank 25_showoutpout.txt file.In the process list I can see the process running, but it doesn't redirect the output in the txt file.When i run the command from the command line it runs fine.Please help me.
    Thanks in advance

    Hi,
    I have written the following program to get the output.But still the required output is not coming in the console file.Only the messages that gets printed in the parent console that is coming in the file.But the expected output is to get the messages from the child window which gets executed while the .exe runs.
    import java.io.*;
    public class RuntimeExecTest{
    public static void main(String args[]){
    String s = null;
    String result= null;
    int count =0;
    try{
              // read the output from the command
    String cmd = "cmd.exe /c D:/installer/PsTools.zip/PsTools/psexec.exe ipaddress -u userid -p password -l -c excute.exe >> C:/RuntimeExec_25.txt";
         Process p = Runtime.getRuntime().exec(cmd);
         InputStream is = p.getInputStream();
         // Get the std in to the process.
         OutputStream os = p.getOutputStream();
         // Get the std err from the process.
         InputStream es = p.getErrorStream();
         // Create readers for those streams.
         BufferedReader reader = new BufferedReader(new InputStreamReader(is));
         BufferedReader errReader = new BufferedReader(new InputStreamReader(es));
         String line;               
         // Read STDOUT into a buffer.
         // If no STDOUT check STDERR.
         while((line = errReader.readLine()) != null){
              // Do something with data here if you wish.
         System.out.println( line );
         while((line = reader.readLine()) != null){
              // Do something with data here if you wish.
         System.out.println( line );
         System.exit(0);
    catch( Exception ex )
    ex.printStackTrace();
    }

  • Runtime.getRuntime().exec problems running with applet

    Hi,
    I am running the command
    Process prc = Runtime.getRuntime().exec("net config workstation");
    InputStream in = prc.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    line = br.readLine();
    When running from an application(/stand alone program) on Win-NT it runs fine. But when i include the same code in an Applet and try to run.
    It doesnt return any thing. I see the DOS-prompt open and close and i can also see the required output generated on the DOS prompt, but the program doesnt return any results(null) in the InputStream.
    I even tried to get the ErrorStream incase it is writing some error but it doesnt write anything.
    I tried running some other commands like (cmd.exe /c set) which were able to run on both application as well as from the applet.
    I have tried giving the "net config workstation" command in all flavors
         String[] cmd = new String[3];
         cmd[0] = "cmd.exe";
         cmd[1] = "/C";
         cmd[2] = "net config workstation";     
    And      
         String[] cmd = new String[3];
         cmd[0] = "net.exe";
         cmd[1] = "config";
         cmd[2] = "workstation";          
    AND
         String[] cmd = new String[5];
         cmd[0] = "cmd.exe";
         cmd[1] = "/C";
         cmd[2] = "net.exe";
         cmd[3] = "config";
         cmd[4] = "workstation";     
    AND giing the full path as
    C:\winnt\system32\net.exe config workstation
    But still it doesnt work.
    Can anybody please suggest what is the problem.Its Urgent.....
    Well the purpose of this is to get users system properties like the Logon Domain , server name etc.... or else can anybody suggest a better way to obtain this information.....
    Your reply will be highly appriciated...
    Thanks in Advance......

    Thanks for atleast replying.....
    Sorry, i forgot to mention.... yes OfCourse, i am using an Signed Applet..... That how i was able to run the "set" command.....
    I have made sure it is not sucha simple problem..... the thing is as i have mentioned i know that even "net config workstation" works..... cause i see the output on the DOS prompt,.... but this output is not returned to the Applet in the getInputStream()/getErrorStream().....
    Can anybody please suggest a way to get this output..... OR is there some other way to get the machine's domain, server name etc info from the machine....?????
    Thanks in Advance...!!

  • 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?

  • Runtime.getRuntime().exec problem with linux script.

    Hello,
    I try to start a script under Linux RedHat 9. This script must just create another file.
    I work with JDK 1.4.1_02b06.
    If I use the next command
    process = Runtime.getRuntime().exec("/temp/myScript.sh");
    This is not working. I script file is existing otherwise I receive an error. I don't understand why the script is not executed!
    I have check some other posts in this forum but I cannot find the solution.
    Thanks in advance for your help.
    Alain.

    Try running it with sh: Runtime.getRuntime().exec("sh /temp/myScript.sh");

  • Runtime.getRuntime.exec() Problem

    hi,
    I want convert MS Office documents to PDF through my aaplication which is online. I'm using PDFCreator.exe for doing this.
    From a standalone Java program the command is executed properly.
    But If I call the same program from a JSP the PDFCreator.exe is started, but it doesnt convert the document to PDF, also the .exe keeps on running for a long time and does not exit. the JSP prints "Files Converted" before the Java program has finished execution or give error as "Proocess has not exited".
    My JSP code:
    <%@ page import="java.io.*,java.util.*"%>
    <%@ page import="pack.Test.*"%>
    <%
    try{
    pack.Test t=new pack.Test(); //initialixe the java class
    t.print();//call  the function
    }catch(Exception e) {e.printStackTrace();}
    %>
    <br>File Converted Code for Java program:
    package pack;
    import java.io.*;
    import java.lang.Process;
    import java.lang.Runtime;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class  Test
    Process p;
    Runtime r;
    BufferedReader stdInput,stdError,br,buff,Input;
    int i=0;
    public void print()
    String cmd="C:\\Program Files\\PDFCreator\\PDFCreator.exe /NOSTART /PF
    \"C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\
    \Reports\\1.doc\"";
    System.out.println("In print="+cmd);
    try{
    p = r.getRuntime().exec(cmd);
    //p.waitFor();
    stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    System.out.println("Input="+stdInput);
    System.out.println("Error="+stdError);
    } catch(IOException ioe){System.out.println("Exception="+ioe);}
    //catch(InterruptedException ie){System.out.println("Exception="+ie);}
    } //end of print fnction
    } //end of class Even if I dont use waitFor() then too the process continues for a long
    time without any output.

    Read the following.
    [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=1]

  • Runtime.getRuntime().exec() and Garbage Collection

    I am programming a piece of software in both Java and C that has some strict real time requirements. Garbage collection, which pauses all threads in Java, sometimes causes loss of incoming data. In order to get around this, I am thinking to start another process using Runtime.getRuntime().exec("c_program") and using interprocess controls (in a UNIX environment) to retrieve data from the new process.
    My only worry is that the Process created by the above call would be a child process of whatever JVM thread created it, (as far as I understand, the JVM implementation in Unix uses multiple processes) and would also be paused when garbage collection occurs. Does anyone know the implementation of the exec functionality and the JVM well enough to say that this will or will not happen?
    Thanks in advance,
    Benjamin

    You're going to create a whole new process? I don't
    know what a "child process" means, but Runtime.exec()
    gets the operating system to produce an entirely new
    process, outside the JVM. However if it produces
    output on stdout or stderr, you're going to have
    threads in your JVM that read that output, otherwise
    that process will hang.
    Why is your idea better than just calling the C
    program via JNI?Thank you both for your replies. My plan was to create a whole new process, yes. In UNIX, a process C is created by another process P using fork() or the exec() family. Process P is then the parent of process C, and process C is the child of Process P. P has an amount of control over C since it can send various signals to pause, kill, etc to C.
    My concern was that the JVM implementation would use these signals to implement the pause of all threads before garbage collecting. If it did, it may also pause the Process that it spawned from the Runtime.exec() call. Pausing my C program in this manner would cause the loss of data I was trying to avoid in the first place.
    My plan for the new process was not to produce anything on stdout or stderr, but to pass data back to the JVM using ipc (interprocess communication) resources of UNIX. I would have to use the JNI to access these resources.
    The whole reason for wanting to do this is to avoid the pause during garbage collection that all Java Threads experience. If I were just to call the C program through the JNI with a normal Java Thread as I think you were suggesting, this Java Thread would still be paused during garbage collection.
    To the second reply about RTSJ, I had heard about this but couldn't find info about it! Thanks for the link. I'm checking it out at the moment. The java runtime must be considerably different for the specifications I see that they guarantee.
    Again, thanks for the replies,
    Benjamin

  • Running curl command from a java program using Runtime.getRuntime.exec

    for some reason my curl command does not run when I run it from within my java program and errors out with "https protocol not supported". This same curl command however runs fine from any directory on my red hat linux system.
    To debug the problem, I printed my curl command from the java program before calling Runtime.getRuntime.exec command and then used this o/p to run from the command line and it runs fine.
    I am not using libcurl or anything else, I am running a simple curl command as a command line utility from inside a Java program.
    Any ideas on why this might be happening?

    thanks a lot for your response. The reason why I am using curl is because I need to use certificates and keys to gain access to the internal server. So I use curl "<url> --cert <path to the certificate>" --key "<path to the key>". If you don't mid could you please tell me which version of curl you are using.
    I am using 7.15 in my system.
    Below is the code which errors out.
    public int execCurlCmd(String command)
              String s = null;
              try {
                  // run the Unix "ps -ef" command
                     Process p = Runtime.getRuntime().exec(command);
                     BufferedReader stdInput = new BufferedReader(new
                          InputStreamReader(p.getInputStream()));
                     BufferedReader stdError = new BufferedReader(new
                          InputStreamReader(p.getErrorStream()));
                     // read the output from the command
                     System.out.println("Here is the standard output of the command:\n");
                     while ((s = stdInput.readLine()) != null) {
                         System.out.println(s);
                     // read any errors from the attempted command
                     System.out.println("Here is the standard error of the command (if any):\n");
                     while ((s = stdError.readLine()) != null) {
                         System.out.println(s);
                     return(0);
                 catch (IOException e) {
                     System.out.println("exception happened - here's what I know: ");
                     e.printStackTrace();
                     return(-1);
         }

  • Runtime.getRuntime().exec - relies on the J2RE?

    Well here is a problem...
    My program works fine using the Runtime.getRuntime().exec command, and the program works as-intended on my computer. But that's because I have the latest and greatest Java apparel (especially the J2RE).
    Now, a friend of mine who does not program, took my program and tried it on his computer. It worked (the GUI loaded and buttons functioned) but it didn't actually do anything other than serve as a nice-looking GUI lol.
    The problem was, it was creating the file I had it create (using FileWriter) but it wasn't EXECUTING that file like I designed the program to.
    I used the Runtime.getRuntime().exec to execute the file - my question is, if the person doesn't have the Java Runtime Environment, will that command work? He clearly has Java on his computer (the GUI loaded) but he might not have the J2RE...
    Any thoughts? Any suggestions for an alternative way to execute a file?
    Thanks!
    -Josh

    I don't understand why this wont work on other
    people's computers...
    I create the file "commands.bat" in their C:\
    directory. I then have the following command to
    execute it:
    Runtime.getRuntime().exec("cmd.exe /c
    \"C:\\crasher.bat\"");It works perfect for me... But it doesn't work for
    other people. For other people, it creates the batch
    file in the right place, it just wont execute it and
    I am not sure why...
    -JoshYou said "commands.bat" but your code is executing "crasher.bat". I have the feeling you're trying to crash their computers or something?
    cmd.exe is an executable on certain flavors of Windows. Other flavors of Windows have command.exe, not cmd.exe. So you have to pick the same platform, or make the actual command that you execute be dynamic (read it from a property file to determine what to execute).
    Go to those other machines and see if you can execute that same command from the command line. Do some debugging for pete's sake.

  • Inconsistent exit code from Runtime.getRuntime().exec

    I'm getting non-deterministic behavior from a call to a native process. Here is the code:
    public class Test {
    public static void main (String[] pArgs) {
    try {
    String cmd[] = { "cmp", "-s",
    pArgs[0],
    pArgs[1] };
    System.err.println("running command: ");
    Process p = Runtime.getRuntime().exec(cmd);
    System.err.println("getting exitcode...");
    int exitcode = p.waitFor();
    System.err.println(exitcode);
    System.err.println(p.exitValue());
    } catch(Exception e) {
    System.err.println("Caught exception while executing cmd");
    e.printStackTrace();
    And here is the output:
    bock@homeruns[~/work/index]10:08> java Test output output.old
    running command:
    getting exitcode...
    0
    0
    bock@homeruns[~/work/index]10:08> java Test output output.old
    running command:
    getting exitcode...
    1
    1
    bock@homeruns[~/work/index]10:08> java Test output output.old
    running command:
    getting exitcode...
    0
    0
    they should all be 1's because the files are different. when i run it on the command line i get:
    bock@homeruns[~/work/index]10:13> cmp -s output output.old ; echo $?
    1
    any help would definitely be appreciated!
    thanks,
    roger

    thanks for the link. i read through it but it doesn't seem to address why the exit code would be inconsistently reported. the other problems described by that link don't seem to apply to this case because i have not experienced hanging and there is no standard input, standard output, or standard error associated with "cmp -s" - all it does is return the appropriate exit code.
    should i be reporting this as a bug to sun? up till recently i've been assuming it was a problem with my code but now i'm not so sure...

  • 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.

  • Runtime.getRuntime().exec and quoted strings?

    Attempting to execute a command containing a quoted string. Being very new to Java I'm guessing I'm not doing it right. Below are two code bits the first one works the second doesn't. So the question is "How do I use quoted strings in a command with .exec?"
    // this one works
    try {               
    p = Runtime.getRuntime().exec("ls -l tst.java");
    p.waitFor();
    System.out.println("Done!");
    catch(Throwable e) {                                  
    system.out.println("Errors!");
    // this one fails
    try {               
    p = Runtime.getRuntime().exec("ls -l \"tst.java\"");
    p.waitFor();
    System.out.println("Done!");
    catch(Throwable e) {                                  
    system.out.println("Errors!");

    I don't know if it is too late for the answer, but I think I know what the problem is.
    You are using exec(String) method, and passed String parameter is parsed using StringTokenizer class. This means that when you use quotes as in "file1 file2", StringTokenizer parses this as "file1 and then file2" so it is not understandable command.
    To solve the problem, do not use exec(String) method, use exec(String[])
    Using this you can send separate command and separate parameters as in following example:
    If you want to send (in Unix)
    grep "SHOW lotid" text.txt
    (using exec("grep \"SHOW lotid\" text.txt") would not work)
    Do the following
    exec(new String[]{"grep", "SHOW lotid", "text.txt"});
    This avoids parsing problem when quotes are used.
    Mehmed

  • Wierdness w/ Runtime().getRuntime().exec between 8.1.6 and 8.1.7

    A Java SP that executes OS commands runs fine in 8.1.6, but doesn't run in
    8.1.7 when a window is generated as a result of the call. The Java class
    follows:
    package com.crtinc.oracle.util.osrun;
    import java.io.*;
    public class SimpleRunner extends Object {
    //just run the daggone command, don't worry about any errors, feedback,
    etc...
    public static void run(String cmd) throws IOException {
    Runtime.getRuntime().exec(cmd);
    The call spec follows:
    CREATE OR REPLACE PACKAGE SIMPLERUNNER AUTHID CURRENT_USER AS
    PROCEDURE RUN ("cmd" IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'com.crtinc.oracle.util.osrun.SimpleRunner.run(java.lang.String)';
    END SIMPLERUNNER;
    When deployed to v8.1.6 by a user with JAVASYSPRIV, the following call from
    SQL*Plus runs and displays a window:
    exec simplerunner.run('notepad.exe');
    When deployed to v8.1.7, the same call causes notepad.exe to be added to the NT
    Task Manager Processes tab, but the notepad window doesn't actually open up.
    FWIW, the above code is a simple example - myactual utility captures the
    output streams of OS commands, very much along the lines of sample code that
    I've seen on Metalink - this also works fine in 8.1.6, but never returns in
    8.1.7.
    Granted, running Notepad is of limited utility (though it demos very well :-),
    but other useful OS commands that spawna window (such as kicking of an Oracle
    Report, which pops up a small status window) do not run now in 8.1.7. Running
    a completely non-visual process seemsto work fine, however.
    Any help much appreciated!
    Thanks
    Jim

    Well, just for anyone who might be facing such an issue in the future...
    I am running the databse on NT and it turns out that my NT service didn't have the 'Allow Service to Interact with Desktop' checkbox selected, so that's why OS commands that generated windows weren't showing up. Checking that checkbox and stopping/restarting the service solved the problem.
    Jim
    null

  • Runtime.getRuntime().exec portability problem

    Hello everyone!
    I've got a problem with running external application (in my case it's pdfLaTeX). The code looks as follows:
    System.out.println(AppConfig.getExeFile() + " " + params); // AppConfig.getExeFile() is a static function that outputs a String object.
    Process p = Runtime.getRuntime().exec(AppConfig.getExeFile() + " " + params); // params is a String object as well.
    p.waitFor();
    // ...On Linux everything works great. System.out.println() outputs the following line:
    /opt/texlive/bin/pdflatex -halt-on-error   -output-directory /tmp   /tmp/tabular.texThe application executes successfully.
    However, I can't get my program to run on Windows. In this case, the generated command looks as follows:
    "C:\Program Files\LaTeX\MiKTeX 2.7\miktex\bin\pdflatex.exe" -halt-on-error   -output-directory C:\DOCUME~1\Roman\USTAWI~1\Temp   C:\DOCUME~1\Roman\USTAWI~1\Temp\tabular.texAfter displaying this line, my application freezes. The child process (pdflatex.exe) is frozen as well. Then I kill both processes.
    Here's the PdfLaTeX's log file after failure:
    {C:/Documents and Settings/All Users/Dane aplikacji/MiKTeX/2.7/pdftex/config/pd
    ftex.map}
    !pdfTeX error:  (file C:/Documents and Settings/All Users/Dane aplikacji/MiKTeX
    /2.7/pdftex/config/pdftex.map): fflush() failed
    ==> Fatal error occurred, no output PDF file produced!and here's how it should look like:
    {C:/Documents and Settings/All Users/Dane aplikacji/MiKTeX/2.7/pdftex/config/pd
    ftex.map}] (tabular.aux) )
    Here is how much of TeX's memory you used:
    202 strings out of 95340
    2116 string characters out of 1183965
    46926 words of memory out of 1500000
    3474 multiletter control sequences out of 110000
    3640 words of font info for 14 fonts, out of 1200000 for 2000
    14 hyphenation exceptions out of 8191
    23i,6n,17p,173b,100s stack positions out of 5000i,500n,10000p,200000b,5000s
    <C:/Program Files/LaTeX/MiKTeX 2.7/fonts/type1/bluesk
    y/cm/cmr10.pfb>
    Output written on tabular.pdf (1 page, 10003 bytes).
    PDF statistics:
    10 PDF objects out of 1000 (max. 8388607)
    0 named destinations out of 1000 (max. 131072)
    1 words of extra memory for PDF output out of 10000 (max. 10000000)I suspected that the problem was caused by presence of spaces in command (I've tried several other solutions such as putting parameters into String[] array, escaping, adding double-quotes, putting the command to the batch file), but when I run my the same command from the command line, everything works fine.
    I believe that I'm making some kind of a stupid mistake because it doesn't look like it's pdfLaTeX's fault.
    Thanks in advance for your hints. Solutions are welcome as well ;-)

    Hi,
    What is probably happening is that the process is being blocked because you are not reading the output.
    This is a common problem with exec.
    Read this article:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    HTH,
    Eugenio Alvarez

Maybe you are looking for

  • Installing Driver Software (full) for HP 4500 G510n-z

    I have tried to download the software for my HP4500 G510n-z on my Fujitsu laptop running Windows 7 Professional. Each time it comes back with the message "Installation Failed" and then starts removing the partaily installed software pieces, and start

  • Repetation of batch no avoid

    *Hi friends,*                     *Here i am using ext no range for batch managment.but here i don't want same no should be repeat for any next batch.* *For ex-: 999 batch no is used for 1 one material while movements, that should not be used in any

  • How to change layout of KM Basic Search

    Hi all,        I have a question about the layout of the KM Basic Search. I've created a new Search Component Set in System Administration >System Configuration>KM>CM>User Interface-->Search. I've added search_input_indexes as Component for Basic Sea

  • Change UOM in SRM

    Hi,      Presently for a Particular product UOM is reflecting in SRM as 'BOT',where as this UOM is not maintained in Tcode CUNI.We need to change this UOM from 'BOT' to 'BO'.How to change this in EBP. Appreaciate your Inputs!! Thanks Rakesh.

  • Cleaner 6.5 for MAC

    Does anyone know if cleaner 6.5 works on the powermac pro computers?