Article View: borland.public.jbuilder.java.api
Article #386Re: open / execute
From: 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.
Technical Details
Message-ID:
<3f996ef3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f983bd0@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,4c173bc4a0f787e9 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-10-24 11:39:39 PST Date: Fri, 24 Oct 2003 11:26:59 -0700 From: Shankar Unni <shankar@cotagesoft.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (Compact) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.api Subject: Re: open / execute References: <3f983bd0@newsgroups.borland.com> In-Reply-To: <3f983bd0@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 64.165.207.59 Message-ID: <3f996ef3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1067020019 64.165.207.59 (24 Oct 2003 11:26:59 -0700) Lines: 18 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail