problems with exec("rundll32.exe shell32.dll...")

Øyvind Harboe oyvind.harboe@zylin.com
Tue May 20 13:34:00 GMT 2003


>hi,
>
> thanks but this hasn't worked either - in fact passing any 
>file as the arg[0] makes no difference(!), I don't think its 
>even getting that far (altered the code to as below)
>
>I don't understand exactly how this could be going wrong, 
>unless maybe "_" is somehow munged by Runtime.exec?

I wish getting up to speed on source code debugging of libgcj was
not quite such an alienating experience. I'm going to have to
learn GDB for a C++ project soon, so I'll get there...

Thats really the next step though.

You seem to be familiar with StringTokenizer(never used it), so
perhaps you can glean some wisdom from the implementation in the 3.3 
branch:

http://savannah.gnu.org/cgi-bin/viewcvs/gcc/gcc/libjava/java/lang/Runtim
e.java?rev=1.12&only_with_tag=gcc-3_3-branch&content-type=text/vnd.viewc
vs-markup


 public Process exec(String cmdline, String[] env, File dir)
    throws IOException
  {
    StringTokenizer t = new StringTokenizer(cmdline);
    String[] cmd = new String[t.countTokens()];
    for (int i = 0; i < cmd.length; i++)
      cmd[i] = t.nextToken();
    return exec(cmd, env, dir);
  }

  public Process exec(String[] cmd, String[] env, File dir)
    throws IOException
  {
    SecurityManager sm = securityManager; // Be thread-safe!
    if (sm != null)
      sm.checkExec(cmd[0]);
    return execInternal(cmd, env, dir);
  }

And then on to the actual implementation for Win32.


http://savannah.gnu.org/cgi-bin/viewcvs/gcc/gcc/libjava/java/lang/natRun
time.cc?rev=1.29.2.5&only_with_tag=gcc-3_3-branch&content-type=text/vnd.
viewcvs-markup


http://savannah.gnu.org/cgi-bin/viewcvs/gcc/gcc/libjava/java/lang/natWin
32Process.cc?rev=1.1.46.2&only_with_tag=gcc-3_3-branch&content-type=text
/vnd.viewcvs-markup

Øyvind



More information about the Java mailing list