open up a word document with Ms Word

From Java, it is very easy to open up another program (thanks to Venci75). But what happen if open another program with its own file?

For example, if i want to open up a document file (.doc) with Ms Word from java, what should be the code look like?
HeliumyapAsked:
Who is Participating?
 
Venci75Connect With a Mentor Commented:
I mean:
Runtime.getRuntime().exec("cmd /c start c:/...<the path to your document>");
0
 
Venci75Commented:
try this:

Runtime.getRuntime().exec("cmd /c start c:/temp/kiki.doc");
0
 
HeliumyapAuthor Commented:
Wow! it work! But what does "cmd /c start" mean? Could you explain abit?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
HeliumyapAuthor Commented:
does cmd means the command in dos prompt?
0
 
Venci75Commented:
this actually is a thrick. This starts the command promt. /c means that the commands after that will be executed and after that the command prompt will be closed. Now I am actually looking for a better way - that doesn't show the command promt, but with no success til now
0
 
Venci75Commented:
aha - I found it:
Runtime.getRuntime().exec("explorer c:\\temp\\my_doc.doc");

this force the windows explorer to find the application for this document, and open the document with it
0
All Courses

From novice to tech pro — start learning today.