Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

open up a word document with Ms Word

Posted on 2002-06-14
6
Medium Priority
?
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 800 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.
Suggested Courses

670 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