Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Suggest Mac API method for launching an application.

Suggest Mac API method for launching an application.
Thread Tools
Fresh-Faced Recruit
Join Date: May 2001
Location: India
Status: Offline
Reply With Quote
May 25, 2001, 01:51 AM
 

hi,
I want to open any application based on the extension of the file through my java program. For example, if i have a abc.doc file then it must be launched in MS Word.
For this i have used native method (JNI approach) and used Window API method, ShellExecute(). Now i want the same thing using Mac API.

So can anyone tell me a Mac API method for doing the same.
Please help. Its urgent.

Thanx n Regds.
Rachna
     
curmi2
Guest
Status:
Reply With Quote
May 25, 2001, 02:33 AM
 
I don't know if there is an API. However, there is a command line program called "Open" I think - which will Open a file with the application associated with it. You might be able to do something like

system("Open file.doc");

but I'm not sure.
     
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status: Offline
Reply With Quote
May 25, 2001, 03:46 AM
 
LaunchServices will find the right application depending on Type/Creator and/or extension for you. There is some example code in TechNote 2017
http://developer.apple.com/technotes/tn/tn2017.html


Developer
Nasrudin sat on a river bank when someone shouted to him from the opposite side: "Hey! how do I get across?" "You are across!" Nasrudin shouted back.
     
Rachna  (op)
Fresh-Faced Recruit
Join Date: May 2001
Location: India
Status: Offline
Reply With Quote
May 25, 2001, 07:08 AM
 

thanx very much for the reply. It helped me very much.
open command is allowing me to open any file in its associated Application from the local disk.

Now my problem is that, i want to open the web page, like www.google.com in the default browser. For this i tried: open http://www.google.com, or http://www.abc.com/xyz.html
But this command is not able to do so.
i think its searching only the local drive for the required file.

Now what should i do?
     
curmi2
Guest
Status:
Reply With Quote
May 27, 2001, 05:04 PM
 
Not sure how to do this. Sorry. Maybe the link that Developer supplied will help?
     
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
May 27, 2001, 07:16 PM
 
Moving this to the OS X Developer forum. Click through to find yourself.

thanks

------------------
the oddball newsletter
------------------
it's only after you lose everything that you're free to do anything
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 27, 2001, 07:37 PM
 
Please try one forum next time. It's more than enough.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:15 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2