Hi,
I tried the following,but it did not work
Runtime.getRunTime().exec("open /Applications/Microsoft\\Ofiice\\2004/Microsoft\\Word")
I tried this too ,but did not work
Runtime.getRunTime().exec("open /Applications/Microsoft Ofiice 2004/Microsoft Word/")
Can u pls code the correct way of using this
Any of these two:
Code:
Runtime.getRunTime().exec("open /Applications/Microsoft\\ Office\\ 2004/Microsoft\\ Word.app");
Runtime.getRunTime().exec("open \"/Applications/Microsoft Office 2004/Microsoft Word.app\"");
In the first version, every space is escaped for the shell. This is done with the \ character. Because that character is reserved in Java strings, you'll have to espace it so it becomes \\. The mistake you made with your version was leaving the spaces out.
In the second version, the path is quoted so the open command gets it as one parameter. The " is escaped using \ because it would otherwise end the string.
By the way, as noted earlier you misspelled Office in that path, and .app is parth of the name of that directory. Also I think it isn't a very good idea to hardcode paths to apps.
And you should have been able to find this out by yourself, really.