🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7974

Re: Getting Def

#7974
From: Erwin Olaerts
Date: Fri, 04 May 2001 12:14
41 lines
2403 bytes
Thanks for your help. I also find a way to execute a file with its default
program.
It can be done with the following command:

          Runtime.getRuntime().exec("cmd /c Start filename.pdf");

The only thing is that this shows a DOS windows for a very short moment.

"John McGrath [TeamB]" <ng-b@JPMcGrath.net> schreef in bericht
news:MPG.155bfe5339e0223c98a18f@forums.borland.com...
> On Thu, 3 May 2001 16:06:27 +0200, Erwin Olaerts wrote:
>
> > Is it possible to get the default program of a Windows
> > environment for a certain file-type ???
> >
> > For example: I want to know what (and where) the default
> > application for opening PDF-files is on a certain system.
> > Lets say it's Adobe Acrobat Reader 5.0 and the exe to run
> > is C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe
> > Is it possible to retrieve this information in Java ???
> > And how do I do this???
>
> As far as I know, there is no easy way to determine the application
> associated with a file type without resorting to native code.
>
> But this will probably do what you want.  Of course, this is Windows
> only:
>
>    Runtime.getRuntime().exec( new String[] { "rundll32",
>       "url.dll,FileProtocolHandler", fileName } );
>
> This should launch the application associated with the specified file.
>
> --
> Regards,
>
> John McGrath [TeamB]
>
> ---------------------------------------------------
> Before sending me e-mail, please read:
>     http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <3af29d21_2@dnews>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3af165f4_2@dnews> <MPG.155bfe5339e0223c98a18f@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,23c4ef4f8da51747
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-04 05:40:05 PST
From: "Erwin Olaerts" <erwin.olaerts@idp.be>
Newsgroups: borland.public.jbuilder.java.language
References: <3af165f4_2@dnews> <MPG.155bfe5339e0223c98a18f@forums.borland.com>
Subject: Re: Getting Def
Date: Fri, 4 May 2001 14:14:09 +0200
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 212.123.9.31
Message-ID: <3af29d21_2@dnews>
X-Trace: dnews 988978465 212.123.9.31 (4 May 2001 05:14:25 -0700)
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews