Solved

open up a word document with Ms Word

Posted on 2002-06-14
6
167 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now