The Artima Developer Community
Sponsored Link

Java Answers Forum
Runtime.exec() method

4 replies on 1 page. Most recent reply: May 13, 2005 9:16 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Debasish Das

Posts: 3
Nickname: devdas123
Registered: May, 2005

Runtime.exec() method Posted: May 10, 2005 9:27 PM
Reply to this message Reply
Advertisement
I am trying to run following code...

String command = "batch.bat";
Process child = Runtime.getRuntime().exec(command);

When the batch-file contains some command that doesn't involve any file operation then the code is running fine.
But when it contains some commands related to file creation/modification , then the code is getting hanged.

I have used the following command in batch-file...

echo inside batchfile
pause
edit test.dat
pause

first line is getting executed but program gets hanged when it comes to second line. The batch-file is running fine when it is being executed from commandline. Can anyone solve this problem?

-devdas123


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Runtime.exec() method Posted: May 10, 2005 11:32 PM
Reply to this message Reply
Just a thought:
Try executing "cmd /C batch.bat"

This solved several problems I had in the past.

Debasish Das

Posts: 3
Nickname: devdas123
Registered: May, 2005

Re: Runtime.exec() method Posted: May 11, 2005 12:01 AM
Reply to this message Reply
Hi Neumi,
Your suggestions results no change....

Debasish Das

Posts: 3
Nickname: devdas123
Registered: May, 2005

Re: Runtime.exec() method Posted: May 11, 2005 12:10 AM
Reply to this message Reply
Hi Neumi,
Your suggestion results no change....

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Runtime.exec() method Posted: May 13, 2005 9:16 PM
Reply to this message Reply
Are you trying to do this in an applet?

If not, have you tried the same batch file with the same user account on the command line?

Flat View: This topic has 4 replies on 1 page
Topic: creating a virtual key Previous Topic   Next Topic Topic: Java and Ms Access database integrating together

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use