I'm trying to make a local java appication that would like to run an exe file with a parameter (say a text file). I've looked into several books and it said nothing about it. Thank you in advance.
for an article on how to use Runtime.exec() correctly. There are a few issues that you need to be concerned with.
Also, does it have to be your own Java program. I recommend you take a look at Ant project at jakarta.apache.org. The use of Ant is quite easy. There is a supported task called 'exec'. It may be easier for you to create a build.xml file then to interface with Ant from your Java program????
Hi whodaman,
It is possible to invoke an application with parameters.
For eg.,
Runtime r = Runtime.getRuntime();
r.exec("notepad"
would open an untitled notepad, while,
r.exec("notepad c:\\logfile.txt"
would open up the logfile.txt file.
So the same, should be applicable to other applications too.
Hope this helps.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.