Solved

open up a word document with Ms Word

Posted on 2002-06-14
6
169 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java 8 lambda expresssions exception handling 3 91
jdbc error in jsp application 20 46
check java version using powershell 13 93
Tomcat: Unable to run tomcat service. 2 20
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

810 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