 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ralph Steins Guest
|
Posted: Thu Oct 23, 2003 8:36 pm Post subject: open / execute |
|
|
Hi,
I need a functionality similar to the "open" function in the
(windows)explorer. "open" a file with the corresponding application. Is
there something?
I can use Runtime.exec() only with the application name. I would favour a
more flexible way because at programming time are not all types of
applications known.
(btw: is it possible to get registered applications from the os (like Word
for *.doc, *.dot)?)
Ralph
|
|
| Back to top |
|
 |
Shankar Unni Guest
|
Posted: Fri Oct 24, 2003 6:26 pm Post subject: Re: open / execute |
|
|
Ralph Steins wrote:
| Quote: | I need a functionality similar to the "open" function in the
(windows)explorer. "open" a file with the corresponding application. Is
there something?
|
This is fairly windows-specific functionality, but at least on Windows,
you can easily emulate this by doing the following (provided that the
file extension is already registered with Windows):
String[] args = { "cmd", "/c", "start", yourfilename };
Process p = Runtime.getRuntime().exec(args);
(You'll have to do some OS checking: for WinME, 98 and 95, you'll have
to use "command" rather than "cmd", but otherwise the same syntax).
--
Shankar.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|