• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

MRJFileUtils vs. FileManager for Opening Browser

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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: 43011
76
  • Mark post as helpful
  • send pies
  • 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
  • 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".
 
I am Arthur, King of the Britons. And this is a tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!