Thread View: borland.public.jbuilder.java.api
2 messages
2 total messages
Started by Ralph Steins
Thu, 23 Oct 2003 20:36
open / execute
Author: Ralph Steins
Date: Thu, 23 Oct 2003 20:36
Date: Thu, 23 Oct 2003 20:36
13 lines
1265 bytes
1265 bytes
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
Re: open / execute
Author: Shankar Unni
Date: Fri, 24 Oct 2003 18:26
Date: Fri, 24 Oct 2003 18:26
17 lines
1651 bytes
1651 bytes
Ralph Steins wrote:
> 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads