Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #5669
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: runtime.exec problems |
| Date | 2011-06-25 16:09 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <iu5fcm$sv8$1@dont-email.me> (permalink) |
| References | <fe03d675-dca9-40aa-ad12-99dd0cc75cfb@fj19g2000vbb.googlegroups.com> |
On 6/25/2011 1:58 PM, Memo wrote:
> I can't get runtime.exec to execute a program in Java. I am trying to
> execute a bat file. I read that in order to run bat files as opposed
> to .exe files the runtime command has to include "cmd /c start" before
> the name of the bat file. I have run bat files successfully this way
> before.
>
> The command that I am running works when typed from the command line.
> It is:
>
> z:/n4/pkg/MrServers/MrVista/Simu/StartSimEnv.bat -AutoStart
> GOLD_256x512.dat
>
> When I try the following code:
>
> File file = new File(imageDir);
> cmd = "C:\WINDOWS\system32\cmd /c start "+simDir+"StartSimEnv.bat -
> AutoStart " + imageName;
I assume `cmd' is a String, and `simDir' and `imageName' are things
that have reasonable toString() methods. Even so, I cannot imagine how
this would get through a Java compiler, since the only context I can
think of that would make it valid would be to surround it with /* */.
Here's a thought: Show us the actual code, not a half-baked
uncompilable paraphrase. I could make a bunch of guesses about what
your code actually is, and then I could try to debug the code I'd
guessed at -- but the thing you want debugged is your code, not my
guesswork.
--
Eric Sosman
esosman@ieee-dot-org.invalid
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
runtime.exec problems Memo <gamalieli@hotmail.com> - 2011-06-25 10:58 -0700 Re: runtime.exec problems Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-25 16:09 -0400 Re: runtime.exec problems Patricia Shanahan <pats@acm.org> - 2011-06-25 13:38 -0700 Re: runtime.exec problems Roedy Green <see_website@mindprod.com.invalid> - 2011-06-25 13:54 -0700
csiph-web