File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Mac OS and the fly likes opening excel from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "opening excel from java" Watch "opening excel from java" New topic

opening excel from java

amit vijayant

Joined: May 04, 2005
Posts: 1
On Mac excel can be opened by command like
open -a 'Microsoft Excel'
However when using the same from java:
Runtime.getRuntime().exec("open -a 'Microsoft Excel'");
This fails. Any ideas?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

I've never actually tried running any OS command like this (on OS X or any other system), but you might try specifying the full path to the application as in:

not sure if that's the issue or not, but it's the first thing I'd give a try.

[Asking smart questions] [About Bear] [Books by Bear]
Pauline McNamara

Joined: Jan 19, 2001
Posts: 4012
Could it be that you don't need the single quotes around the application name? From the command line you wouldn't have them.

Welcome to Javaranch Amit!
I agree. Here's the link:
subject: opening excel from java
jQuery in Action, 3rd edition