Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5669
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: runtime.exec problems |
| Date | Sat, 25 Jun 2011 16:09:59 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 33 |
| Message-ID | <iu5fcm$sv8$1@dont-email.me> (permalink) |
| References | <fe03d675-dca9-40aa-ad12-99dd0cc75cfb@fj19g2000vbb.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sat, 25 Jun 2011 20:11:02 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="BrOwaJANne849xlH+KPYjQ"; logging-data="29672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+X67S7AfaERZ2oEe8+Y6oi" |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 |
| In-Reply-To | <fe03d675-dca9-40aa-ad12-99dd0cc75cfb@fj19g2000vbb.googlegroups.com> |
| Cancel-Lock | sha1:6DXFeb+PH2Sx9Ike0Lfh1MuwNQw= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5669 |
Show key headers only | View raw
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