Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1689
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Danger, 10,000 volts, very electic .... tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!