Runtime.exec: strange NullPointerException

Hi there!
Since I'm using Runtime 1.4.1-b21 (Windows) it seems that I can't use Runtime.exec any more. The following example code doesn't work:
public class Test
     public static void main(String[] args) throws Exception
          Runtime lRuntime = Runtime.getRuntime();
          Process lProcess = lRuntime.exec("last.exe");
I get the following null pointer exception:
D:\test>java Test
Exception in thread "main" java.lang.NullPointerException
at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.Runtime.exec(Runtime.java:491)
at java.lang.Runtime.exec(Runtime.java:457)
at Test.main(Test.java:23)
I don't know why this happens. 'last.exe' is a simple command line tool. I can use any other program - same error!
Greeting,
Markus

Hi,
I am getting the same exception on Solaris on doing :
rt.exec(command); //rt - Runtime object ; command - String[]
java.lang.NullPointerException
at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.Runtime.exec(Runtime.java:491)
at java.lang.Runtime.exec(Runtime.java:457)
I read through the article mentioned but could not figure out what could be causing the Null Pointer exception in the exec() method of Runtime.
Any pointers/advice would be really helpful.
Thanx

Similar Messages

  • Runtime.exec error - java.lang.NullPointerException

    Hi,
    I am trying out the example code from javaWorld that shows how to use exec to execute external command. The problem is that I aways run into java.lang.NullPointerException on line that has "Process proc = rt.exec(cmd);" I have tried to run the code under Windows XP and Windows 2003; and I get the same error message. Any idea on what might be casing this?
    Thanks,
    // GoodWindowsExec.java
    import java.util.*;
    import java.io.*;
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    public void run()
    try
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    System.out.println(type + ">" + line);
    } catch (IOException ioe)
    ioe.printStackTrace();
    public class GoodWindowsExec
    public static void main(String args[])
    if (args.length < 1)
    System.out.println("USAGE: java GoodWindowsExec <cmd>");
    System.exit(1);
    try
    String osName = System.getProperty("os.name" );
    String[] cmd = new String[3];
    if( osName.equals( "Windows NT" ) )
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = args[0];
    else if( osName.equals( "Windows 95" ) )
    cmd[0] = "command.com" ;
    cmd[1] = "/C" ;
    cmd[2] = args[0];
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1]
    + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
    }

    What is System.getProperty("os.name") returning when you run on Windows XP or 2003?
    You are only filling in your cmd array when os.name is either Windows NT or Windows 95. In other cases, the elements of cmd are left as null.
    The documentation for Runtime.exec() says you will get a NullPointerException when elements of the array are null:
    http://apidoc.org/view/10563?a=exec%28java.lang.String%5B%5D%29

  • Strange behavior when using Runtime.exec() to run batch file

    I've been struggling with this for hours.
    I have a Swing application which upon clicking a button, I want to execute a batch file. This batch file itself uses a command window.
    When I use
    Runtime load = Runtime.getRuntime();
    load.exec("cmd /c start c:\\renew\\renew2\\bin\\win\\renew.bat");
    The program (Renew) will start up no problem, but when I exit Renew, the command window stays put. I want the command window to close. Running Renew stand-alone, upon closing Renew, it will exit the command window.
    When I use
    Runtime load = Runtime.getRuntime();
    load.exec("cmd /c c:\\renew\\renew2\\bin\\win\\renew.bat");
    or
    Runtime load = Runtime.getRuntime();
    load.exec("c:\\renew\\renew2\\bin\\win\\renew.bat");
    When I press the button, sometimes the Renew application will come up right away, sometimes the Renew application will come up after a very long delay, and most times, the Renew application will only come up after I have closed the Swing frame where the button is located. When I use this code, the command window that Renew uses is never visible.
    What I want is to simply have the Renew application behave the same exact way launching from my Swing application as when Renew is being run standalone.
    Any suggestions? Thanks so much.
    Sincerely,
    Will

    Getting rid of start makes the startup time very variable. Sometimes it starts up right away, sometimes after many minutes, most times only after I close my application.
    Thanks, Any other suggestions?
    (BTW, I have read the famous "When Runtime.exec() won't" article, and have tried its suggestions to no avail)
    Message was edited by:
    willies777

  • Strange problem when a c++ program is triggered by Runtime.exec()

    I am working in linux system. I have 2 programs:
    1. one is a c++ program e.g. AAA. In this program, i use "system("gcc ...")" to call gcc to do some internal processing
    2. the other is a java program BBB. In this program, i use Runtime.exec("AAA") to run program AAA.
    case 1
    if I run c++ program AAA directly, everything goes well, gcc call via "system" is successful.
    case 2
    if I run java program BBB to trigger AAA indirectly, the AAA can be executed, but the system call (gcc call inside AAA) is failed.
    so, what is wrong? any hints? what is the solution to make case #2 work? I just want to use BBB to trigger AAA, and the system call should also be successful.
    thanks in advance for your help!

    "...but the system call (gcc call inside AAA) is failed."
    Isn't terribly descriptive, but I'm guessing that it complains it can't find gcc?
    If that's the case then it's because the call to Runtime.exec() runs the code in a shell with no idea where anything is, whereas when you run the C++ code straight it is running in the shell you kicked it off in. Something along those lines anyway.
    Someone else'll be able to tell you how to get it to work. I'm sure I've seen this sort of problem here several times.

  • Start a new java process using Runtime.Exec() seems to ignore the -Xmx

    I am working with a process that requires a minimum of 1.5 GB to run and works better if more is available.
    So I am determining how much memory is available at startup and restarting the jre by calling
    Runtime.exec("java -Dcom.sun.management.jmxremote=true -Xmx1500M -jar XXX.jar")
    which reinvokes the same process with a new max memory size.
    The initial call to the process is
    java -Dcom.sun.management.jmxremote=true -Xmx3500M -jar XXX.jar
    The initial call returns 3262251008 from Runtime.maxmemory()
    When reinvoked through Runtime.exec() as above
    Runtime.maxmemory() still returns 3262251008
    Is there a way to separate the new process from the size specified by the parent process?

    That is strange. Here is a program I wrote which calls itself recursively.
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.List;
    import java.util.ArrayList;
    import static java.util.Arrays.asList;
    public class MemorySize {
        public static void main(String... args) throws IOException, InterruptedException {
            System.out.println("Maximum memory size= "+Runtime.getRuntime().maxMemory());
            if (args.length == 0) return;
            List<String> cmd = new ArrayList<String>();
            cmd.add("java");
            cmd.add("-cp");
            cmd.add(System.getProperty("java.class.path"));
            cmd.add("-Xmx"+args[0]+'m');
            cmd.add("MemorySize");
            cmd.addAll(asList(args).subList(1,args.length));
            Process p = new ProcessBuilder(cmd).start();
            readin(p.getErrorStream());
            readin(p.getInputStream());
        private static void readin(final InputStream in) {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        byte[] bytes = new byte[1024];
                        int len;
                        while((len = in.read(bytes))>0)
                            System.out.write(bytes, 0, len);
                        in.close();
                    } catch (IOException e) {
                        e.printStackTrace();
            }).start();
    }If you run this with the args 128 96 33 222 it prints out
    Maximum memory size= 66650112
    Maximum memory size= 133234688
    Maximum memory size= 99942400
    Maximum memory size= 35389440
    Maximum memory size= 231014400

  • Can we run a java application using Runtime.exec()?

    Can we run a java application using Runtime.exec()?
    If yes what should i use "java" or "javaw", and which way?
    r.exec("java","xyz.class");

    The best way to run the java application would be to dynamiically load it within the same JVM. Look thru the class "ClassLoader" and the "Class", "Method" etc...clases.
    The problem with exec is that it starts another JVM and moreover you dont have the interface where you can throw the Output directly.(indirectly it can be done by openong InputStreams bala blah............). I found this convenient. I am attaching part of my code for easy refernce.
    HIH
    ClassLoader cl = null;
    Class c = null;
    Class cArr[] ;
    Method md = null;
    Object mArr[];
    cl = ClassLoader.getSystemClassLoader();
    try{
         c = cl.loadClass(progName.substring(0,progName.indexOf(".class")) );
    } catch(ClassNotFoundException e) {
    System.out.println(e);
         cArr = new Class[1] ;
         try{
         cArr[0] = Class.forName("java.lang.Object");
         } catch(ClassNotFoundException e) {
         System.out.println(e);
         mArr = new Object[1];
         try{
         md = c.getMethod("processPkt", cArr);
         } catch(NoSuchMethodException e) {
         System.out.println(e);
         } catch(SecurityException e) {
         System.out.println(e);
    try {            
    processedPkt = md.invoke( null, mArr) ;
    } catch(IllegalAccessException e) {
              System.out.println(e);
    } catch(IllegalArgumentException e) {
              System.out.println(e);
    }catch(InvocationTargetException e) {
              System.out.println(e);
    }catch(NullPointerException e) {
              System.out.println(e);
    }catch(ExceptionInInitializerError e) {
              System.out.println(e);
    }

  • Launching another VM instance using Runtime.exec()

    Hi,
    I have two separate Swing applications, say A and B. I need to launch B from A using Runtime.exec() - essentially I am launching another VM instance from one VM. I am encountering strange problems - B's main window comes up, but GUI doesn't update; sometimes B comes up and GUI updates, but huge memory leaks happen. All the problems with B go away once A is shut down. It almost looks like both the instances of VM are sharing (or competing for) the event thread. Any comments will be of great help. Thanks.
    note: There is no problem launching B if A is a console java application (i.e. no Swing GUI).

    I have recently had the same problem, especially with the part where it seems like the two applications are sharing or competing for the same event thread. Sometimes my application B hangs like it is stuck waiting for an event. Sometimes I can get it to unhang by moving the app window around or minimizing it. If it does break free, all the queued events occur in rapid succession. Anybody have any clue what's going on here? It's pretty annoying.

  • Make can't recursively call Make when run from Runtime.exec (for some user)

    This one is a little complicated. The afflicted platform is Mac OS X. It works fine on Linux, it seems, and even then, it does work for some Mac OS X users...
    First, the setup. I have a Java program that has to call GNU Make. Then, GNU Make will recursively call Make in some subdirectories. This results in the following Java code:
    String make = "make"; //on windows, I have this swapped with "mingw32-make"
    String workDir = ...; //this is programmatically detected to be the same folder that the parent Makefile is in
    Runtime.getRuntime().exec(make,null,workDir);This calls make on a Makefile which has the following line early on to be executed (this is only a snippet from the makefile):
    cd subdirectory && $(MAKE)When I fetch the output from the make command, I usually get what I expect: It cd's to the directory and it recursively calls make and everything goes smoothly.
    However, for one particular user, using Mac OS X, he has reported the following output:
    cd subdirectory && make
    /bin/sh: make: command not found
    make: *** [PROJNAME] Error 127Which is like, kinda hurts my head... make can't find make, apparently.
    I've gotten some suggestions that it might be due to the "cd" command acting wonky. I've gotten other suggestions that it may be some strange setup with the env variables (My Mac developer is implementing a fix/workaround for 'environ', which is apparently posix standard, but Mac (Mr. Posix Compliance...) doesn't implement it. When he finishes that, I'll know whether it worked or not, but I get the feeling it won't fix this problem, since it's intended for another area of code entirely...
    Also worth mentioning, when the user calls "make" from the terminal in said directory, it recurses fine, getting past that particular line. (Later on down the road he hits errors with environ, which is what my aforementioned Mac dev is working on). Although calling "make" by hand is not an ideal solution here.
    Anyways, I'm looking for someone who's fairly knowledgeable with Runtime.exec() to suggest some way to work around this, or at least to find out that perhaps one of the User's settings are wonked up and they can just fix it and have this working... that'd be great too.
    -IsmAvatar

    YoungWinston
    YoungWinston wrote:
    IsmAvatar wrote:
    However, for one particular user, using Mac OS X, he has reported the following output:One particular user, or all users on Mac OS?In this case, I have two mac users. One is reporting that all works fine. The other is reporting this problem.
    cd subdirectory && make
    /bin/sh: make: command not found
    make: *** [PROJNAME] Error 127Which is like, kinda hurts my head... make can't find make, apparently.If that is being reported on the command line, then I'd say that make wasn't being found at all.If make isn't being found, then who's interpreting the Makefile?
    It's also just possible that the make script on Mac isn't correctly exporting its PATH variable, though it seems unlikely, since this would surely have been reported as a bug long ago.
    I've gotten some suggestions that it might be due to the "cd" command acting wonky...Also seems unlikely. 'cd' has been around since shortly after the K-T extinction event.
    WinstonBy "acting wonky", I mean being given a bad work directory or some such, such that it's not changing to the intended directory.
    Andrew Thompson
    Andrew Thompson wrote:
    (shudder) Read and implement all the recommendations of "When Runtime.exec() won't" (http://www.javaworld.com/jw-12-2000/jw-1229-traps.html).
    Already read it. I already know the dreadful wonders of Runtime.exec. But in this case, it's been working fine for us up until one Mac user reported that make can't find make.
    Also, why are you still coding for Java 1.4? If you are not, use a ProcessBuilder, which takes a small part of the pain out of dealing with processes.Usually I do use a ProcessBuilder. I noticed that it usually delegates to Runtime.exec() anyways, and seeing as I didn't need any of the additional functionality, I decided to just use Runtime.exec() in this particular case.
    jschell
    jschell wrote:
    So print thos env vars, in your app and when the user does it.I'll look into that. It's a good start.
    -IsmAvatar

  • Runtime.exec() and apostrophe?

    Hi there,
    I try to execute a Unix program using Runtime.exec(). This works as long as I don't need any apostrophe characters:
    works: <path>/<program> <someArguments>doesn't work: <path>/<program> <someArguments> -ls='rm /tmp/test.xml'In the latter case, I get an error message stating a syntax error.
    But when I enter exactly the same command directly into the shell, I don't get an error. Instead, the desired behavior occurs.
    Note: The parameter "-ls" lets the program execute a command once certain criteria are met. But the command in question is not part of the problem. For example, -ls=ll works...
    Thanks in advance for your help! :-)
    btw.: I've already read the "When Runtime.exec() won't" document, so I'm quite sure I didn't run into the shown pitfalls. Well, it could be related to the "Runtime.exec() is not a command line" section, but I haven't been able to figure out how to correct it.
    Kind regards,
    Dennis

    I guess you can remove the test for the SunOS operating system
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.lang.Runtime;
    import java.lang.Process;
    import java.lang.InterruptedException;
    import java.util.StringTokenizer;
    public class JExec {
         private static int lastExitValue = 0;
         public static int getLastExitValue() {
              return lastExitValue;
        public static final String osName= System.getProperty("os.name");
        public static byte[] execUNIXcmd(String commande, byte[] outputData, boolean closeStream) throws NullPointerException {
              Runtime runtime = Runtime.getRuntime();
              Process process = null;
              InputStream inputStream = null;
              OutputStream outputStream = null;
              byte[] bBuf = null;
              String tmpStr = null;
              if (!osName.equals("SunOS")) {
                   System.err.println("Unsupported Operating System");
                   throw new NullPointerException();
              } else {
                   // Dans le cas de SunOs
                   try {
                        process = runtime.exec(commande);
                        outputStream = process.getOutputStream();
                        inputStream = process.getInputStream();
                        if (outputData != null) {
                             outputStream.write(outputData);
                        if (closeStream) outputStream.close();
                        process.waitFor();
                        lastExitValue = process.exitValue();
                        bBuf = new byte[inputStream.available()];
                        inputStream.read(bBuf, 0, inputStream.available());
                        if (!closeStream) outputStream.close();
                        inputStream.close();
                        return bBuf;
                   } catch (InterruptedException e) {
                        System.err.println("ERROR ("+osName+"): Enable to wait the process");
                        throw new NullPointerException();
                   } catch (IOException e) {
                        System.err.println("ERROR ("+osName+"): Enable to read input lines");
                        System.err.println("->"+e.getMessage());
                        throw new NullPointerException();
         public static void main (String[] s) {
              String commande = "echo '$PATH'";
              System.out.println(new String(JExec.execUNIXcmd("sh -e", commande.getBytes(), true)));
    }

  • Runtime.exec and cmd.exe

    Just a quick one here, I think. I'm working on a little tool to merge changes into a document and then copy it over a communications port, and everything seems to be checking out except for that last step. Rather than worrying about streams and whatnot, I'm saving the file to the hard drive; from here, my plan has been to open the DOS prompt and take advantage of its "copy (filename) (port)" command to transfer the file. So in the end, the key line of Java should be something like
    Runtime.getRuntime().exec("cmd.exe copy \"" + fileName + "\" LPT1");My issue here is that the command prompt doesn't seem to want to open using Runtime.exec(). It seems like cmd.exe should do the job -- tossing that into the run menu certainly opens the prompt -- and even just to be sure, I've tried using C:\WINDOWS\system32\cmd.exe explicitly, and both that at cmd.exe without any additional arguments. Strangely, though, the prompt isn't opening, and I'm not getting an I/O error out of it as if I was sending in a bogus command.
    So what am I doing wrong here? What do I have to do to open the DOS prompt?

    As I mentioned, I did try providing the full path to cmd.exe, to no effect.
    Curiously, though, changing "cmd.exe" into "cmd.exe /k" or "cmd.exe /c" both cuased the command to run correctly. Contrary to what they're supposed to do, though, both of them result in the immediate termination of the DOS prompt, even though /k is supposed to cause the window to persist. Any ideas as far as that one goes?

  • Problame with Runtime.exec()

    Hi i am having one problem using Runtime in windows
    When Using Runtime.exec to open any file which is inside a folder having a white space character in its name, i am not able to open the application. I am getting an error messsage that file cannot be found.
    Following is the code
    import java.io.IOException;
    class OpenTest{
    public static void main(String args[]){
    //Folder "dd dd" having white space embedded in its name
    //so the error comes
    String sRegFilePath = "E:\\AAA\\dd dd\\dd.xls";
    try {
    Runtime rt = Runtime.getRuntime();
    rt.exec("cmd /c start "+sRegFilePath,null,null);
    catch(SecurityException se) {
    System.err.println( "SecurityException starting process!");
    catch(NullPointerException ne) {
    System.err.println( "NullPointerException starting process!");
    catch(IndexOutOfBoundsException ioobe) {
    System.err.println( "IndexOutOfBoundsException starting process!");
    catch(IOException e1) {
    System.err.println( "IOException starting process!");
    }

    Hi
    Do this
    String sRegFilePath = " \"E:\\AAA\\dd dd\\dd.xls\" ";

  • Runtime.exec() process output

    I am having strange problems with the output from a program I am executing with Runtime.exec(). This program takes voice input, and generates text output on the commandline. For some reason, I do not see any of the output until the program exits, then everything is displayed. My code is below, any help would be greatly appreciated!
    Thanks,
    Deena
    import java.io.*;
    import java.util.*;
    //Reads and prints the output streams from an executing process
    class ProcessStream extends Thread{
         InputStream is;
         String type;
         ProcessStream(InputStream is, String type){
         this.is = is;
         this.type = type;     //type of output stream, e.g. stdout or stderr
         public void run(){
         try{
              BufferedReader br = new BufferedReader(new InputStreamReader(is));
              String line=null;
                   //read and display the output stream of an executing process
              while ((line = br.readLine()) != null){
              System.out.println(type + ">" + line);
         } catch (IOException ioe){
         System.err.println(ioe);
    //Interface to TalkBack.exe
    public class JTalkBack{
         public static void main(String[] args){
         try{
              String arg="TalkBack.exe -noTTS -noReplay";     //program to execute
              //arguments to program
              for(int i=0; i<args.length; i++){
                   arg+=" "+args;
              //execute the program and get an object representing the process
              Process p=Runtime.getRuntime().exec(arg);
              //create stream processors for stdout and stderr of the process
              ProcessStream error = new ProcessStream(p.getErrorStream(), "ERROR");
              ProcessStream output = new ProcessStream(p.getInputStream(), "OUTPUT");
              //start the stream processors
              error.start();
              output.start();
              //wait for the process to finish and get its exit value
              int exitVal = p.waitFor();
         System.out.println("ExitValue: " + exitVal);
         catch (Throwable t){
         System.err.println(t);

    I have something similar and it works. The only difference is that I:
    1. used a BufferedInputStream instead of the BufferedReader, which means bis.available() and bis.read(buffer) were used instead of .readLine(bis)
    2. Didn't print to stdout, but instead fired a proprietary MessageEvent with the string in it to all MessageListeners (good for use with java.util.logging)
    3. Didn't (yet) put the input streams in different threads.
    Maybe it is related to the fact that you are printing directly back to the System.out again? Does each process in Java get its very own standard out? I don't know.
    It's ugly and convoluted, but maybe a snippet of my code will help...
    (in run)
    Thread myThread = Thread.currentThread();
      try {
        proc = r.exec("my_secret_process.exe -arg arg");
        is = new BufferedInputStream(proc.getInputStream());
        while (thread == myThread) {
          int iRead = 0; //how many bytes did we read?
          //message stream check
          if(is.available() > 0) {
            iRead = is.read(buf);
            msg = "\n"+new String(buf, 0, iRead);
            this.fireMessageArrived(new MessageEvent(this, msg));
         } //end while
       } catch(Exception e) {
          System.out.println("Argh.  Barf.");
      Tarabyte :)

  • Launching another Swing application from existing one using Runtime.exec()

    Hi,
    I have two separate Swing applications, say A and B. I need to launch B from A using Runtime.exec() - essentially I am launching another VM instance from one VM. I am encountering strange problems - B's main window comes up, but GUI doesn't update; sometimes B comes up and GUI updates, but huge memory leaks happen. All the problems with B go away once A is shut down. It almost looks like both the instances of VM are sharing (or competing for) the event thread. Any comments will be of great help. Thanks.
    note: There is no problem launching B if A is a console java application (i.e. no Swing GUI).

    Do you have to have the second application running in a seperate VM (process)? If not completely neccesary, then you can just invoke the static main() of the second class. If the type of the second class isn't known untill run-time, you can use Reflection to invoke the method.
    Miguel

  • Runtime.exec help needed

    Hello,
    I am having a strange problem in using the Runtime.exec(command, null, workDirectory) method. Its giving an IOException and says:
    java.io.IOException: CreateProcess: delmembtrn-05.bat error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:66)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:551)
    at java.lang.Runtime.exec(Runtime.java:418)
    at java.lang.Runtime.exec(Runtime.java:361)
    at java.lang.Runtime.exec(Runtime.java:325)
    Can anyone please guide me whats wrong here? I am trying to run a batch file which will run some java programs. I am running this program from one place and the batch file is in a different place(as represented by the workDir parameter in the exec method). This is holdin up my schedule. Someone can you please help me in this regard. Mail id: [email protected]

    I wanted to produce the same error before giving any advice - so i wrote:
    import java.lang.*;
    public class TestExec
         public static void main(String Arg[])
         throws Exception
              String command="go.bat";
              String envp [] = null;
              String workingDir="c:/temp/WorkingDir";
              Runtime.getRuntime().exec(command,envp,new java.io.File(workingDir) );
    }go.bat is not in path env var...
    I put go.bat into the workingDir and got this error:
    C:\TEMP\TestClass>java TestExec
    Exception in thread "main" java.io.IOException: CreateProcess: go.bat error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Unknown Source)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at TestExec.main(TestExec.java:13)
    Looks pretty similar!
    After changing "go.bat" to "c:/temp/workDir/go.bat" it worked without error...
    So the conclusion is
    that the bat file command string does not specify the right directory
    or
    the bat file is not in the path string
    The working dir parameter is not added to the path env var...
    Tim Smith
    IncWorx

  • Runtime.exec() - how to open new window for new program?

    Hi,
    I have searched through the forums but haven't found an answer to this one yet. I am using runtime.exec() to start up a new java program. At first I thought it wasn't running properly but, after checking task manager, I have discovered that the new program I open runs, it is just completely invisible to me. I am wondering how I can get the new program to run in a command window or something where I can monitor it.
    Thank you for your help,
    Drew

    Thank you all. After trying to figure out why the start command wouldn't work in the runtime.exec() call(not an executable - I am a dolt), I tried putting it in a batch file and it worked perfectly. Thanks for your help,
    Drew

Maybe you are looking for

  • Soundtrack Pro Won't Refresh And Keeps Crashing!

    Hi, Got a lot of issues with Soundtrack Pro, so much so that I've been using the basic Soundtrack version rather than the upgrade. I'm using a G4 with FCP HD and the biggest problem I have with Soundtrack Pro is that it just keeps crashing!! I've als

  • My iPod is not working...I need help!

    About a week ago I noticed that the buttons and touch wheel began not working properly on my 1st gen. nano. I keep it on the car adapter/charger most of the time. I took it off a few days ago and the buttons and touch wheel do not work at all. The on

  • Trying to find system specs

    Hi - I've just brought a second hand X220 which still has a valid warranty. I've got some worries about it - the thinklight, camera and lid sensor don't seem to work - but before i call support and make a fool out of myself I wanted to check if this

  • Excise of Asset material

    Hi What all settings ve to be done in order to capture excise for a asset material. The client is not maintaining material code for assets. Till now they are creating PO against account assignment category ' assets' by giving material description. Ho

  • New at this and looking for advice

    Hi, I am new at Qmasnter and looking for advice. Myself and a few of my other co-workers have been using FCP2 and we have been tossing around the idea of making a Cluster with our computers on our campus. Two of us run on MacBook Pro's, and the other