julielaurek wrote:
Still working but just in case somebody needs it, this worked for the
second piece of Real's code I couldn't run :
String[] cmdArray = {"cmd", "/c", "start", "\"\"",
helpFile.getAbsolutePath()};
Runtime.getRuntime().exec(cmdArray);
I'm not sure where the helpFile part came in ? I must have missed something.
Anyway, when I run Real's example with argument
C:/Documents and Settings/Default User/path_to_.xls"
I get the exception you expressed, but
not when I run it with the DOS file path shown below.
class StartExcel {
public static void main(String args[])
throws java.io.IOException
{
// Win XP
Runtime.getRuntime().exec("cmd /c start
c:/docume~1/defaul~1/path_to.xls");
}
}
My humble opinion: some variant of the suggestions offered
by Manish or Andrew - just ask the user where to find the executable,
either by dialog with a live user or config file.
You missed my point completely (you weren't the only one). The
path_to_.xls is rhetorical. All you have to specify is the path to your
object file. You don't need to know about what or where the program is
that will manipulate it. It works if you have MS Excel or Open Office
or whatever.