Forums Register Login

How to pass arguments dynamically to .exe using Java

+Pie Number of slices to send: Send
Hi
I have an .exe file placed in a directory location. I used the following lines of code to run the .exe file.



But I want the response based on the parameters that I pass to the .exe file. I don't know how to pass the parameters dynamically. Can anyone help on this.

Thanks in advance.
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send

Could you please help me, how to use the Runtime.exec(String[]) in the above code?


+Pie Number of slices to send: Send
 

sanjay kams wrote:But I want the response based on the parameters that I pass to the .exe file. I don't know how to pass the parameters dynamically. Can anyone help on this.


Well, where are your parameters? I don't see any in your code. You can either add them to the end of your command String, separated by spaces, or put them in an array after the command itself and use the method that Pawel suggested (right now, you're NOT).

BTW, I wouldn't code your catch block like that either, because your program will simply carry on after an error.

My advice: Forget the try...catch and just add throws IOException to the method.

Winston
+Pie Number of slices to send: Send
My parameters are given below.

update -sol "Defects" -proj "Software" -trans "New Defect" -rec "653489"
Could you hold this puppy for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1612 times.
Similar Threads
file upload program
why the files are not deleted and not renamed?
how to upload files to My sql with jsp
Efficient way of uploading a media file [img] to server using jsp view
Splitting a zip file and rejoining it
Using wget from java code to download files
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:53:00.