• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

MRJFileUtils vs. FileManager for Opening Browser

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following code opens the default web browser on Mac OS X:



However, it seems that "macClass" can also be obtained from "com.apple.eio.FileManager", and the code still works fine.

So which is better, MRJFileUtils or FileManager? Better being the choice that has the highest likelihood of working on other people's computers and is most likely to work in future versions of Java.
 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The com.apple.mrj.* package was shipped with OS 9 (and maybe early versions of OS X ?). It's not part of the Java 1.4 that is shipped now, so if OS X is your target, the com.apple.eio.* package is the way to go.
But if you're concerned about backwards-compatibility, you can use both, by properly enclosing them in try/catch blocks, and if one fails, use the other.

There's also the MRJAdapter library, which encapsulates this functionality, so your work is done!
[ November 28, 2005: Message edited by: Ulf Dittmer ]
 
Dem Pilafian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. That was exactly what I needed to know. Backwards-compatibility with old outdated stuff is not that important to me, so I'm now going with "FileManager".
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic