Solved

open up a word document with Ms Word

Posted on 2002-06-14
6
170 Views
Last Modified: 2010-03-31
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?
0
Comment
Question by:Heliumyap
  • 4
  • 2
6 Comments
 
LVL 9

Expert Comment

by:Venci75
ID: 7077807
try this:

Runtime.getRuntime().exec("cmd /c start c:/temp/kiki.doc");
0
 
LVL 9

Accepted Solution

by:
Venci75 earned 200 total points
ID: 7077810
I mean:
Runtime.getRuntime().exec("cmd /c start c:/...<the path to your document>");
0
 

Author Comment

by:Heliumyap
ID: 7077821
Wow! it work! But what does "cmd /c start" mean? Could you explain abit?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:Heliumyap
ID: 7077825
does cmd means the command in dos prompt?
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7077827
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
 
LVL 9

Expert Comment

by:Venci75
ID: 7077830
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 56
varialbe initialization 11 37
jsp insert to database example 2 47
Selenium docs api java index 3 48
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question