This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
How can I invoke Word 95 Document from Java?.
Posted by Sandeep Thool on May 11, 2001 at 10:12 AM
In order to invoke an external program from Java code, one has to make use of the class "Runtime". Try this code ------------- public class temp { public static void main(String args[]) { try { Runtime r = Runtime.getRuntime(); r.exec("C:\\WINDOWS\\NOTEPAD.EXE"); } catch(Exception e) { System.out.println(e.toString()); } } } Note: ----- First find the path of your Software (Microsoft Word) by right-clicking on your Microsoft Word's desktop icon. Take a copy of that path & supply that as a STRING to the "r.exec()" method.
Replies:
- hi Abdul May 13, 2001 at 2:44 AM
(1)
|