aspose file tools*
The moose likes Java in General and the fly likes As a command it runs fine from cmd prompt but not from java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "As a command it runs fine from cmd prompt but not from java code" Watch "As a command it runs fine from cmd prompt but not from java code" New topic
Author

As a command it runs fine from cmd prompt but not from java code

sahana mithra
Ranch Hand

Joined: Oct 26, 2010
Posts: 72
The code given below actually tries running a command. This command when run from command prompt, produces the necessary output. But when i try to run the application from java code, it keeps on running and doesn't produce any output file.



Thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

From a single command prompt can you execute three executable files at the same time, probably no. You have to execute one at a time. So you probably code should look somewhat like this.



Swastik
sahana mithra
Ranch Hand

Joined: Oct 26, 2010
Posts: 72
hi,
The format is not as i have given. I have just shown a sample. It l be like arg[0]+cnst[1]+cnst[2]+arg[1]+cnst[3]+cnst[4]+cnst[5]+arg[2]. Any other way to do this???
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
Very common problem - carefully read the JavaDocs for java.lang.Process - take note of the part about the necessity of consuming the stdout, and sterr streams.

A search for "java exec process problem" will find more help.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: As a command it runs fine from cmd prompt but not from java code