Solved

open up a word document with Ms Word

Posted on 2002-06-14
6
165 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countHi challenge 25 84
wordlen challenge 3 47
wordcount challenge 11 78
get weblogic logged in user in java 2 43
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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:

759 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

22 Experts available now in Live!

Get 1:1 Help Now