The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

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:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us