🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Getting Def

#7971
From: John McGrath TeamB
Date: Fri, 04 May 2001 05:59
31 lines
1923 bytes
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: <MPG.155bfe5339e0223c98a18f@forums.borland.com>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!feeder.qis.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3af165f4_2@dnews>

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-03 23:10:02 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Getting Def
Date: Fri, 4 May 2001 01:59:40 -0400
Message-ID: <MPG.155bfe5339e0223c98a18f@forums.borland.com>
References: <3af165f4_2@dnews>
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 988955978 209.92.40.60 (3 May 2001 22:59:38 -0700)
Lines: 31
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!feeder.qis.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews