Opening a Msword document from Frame.
1 posts in topic
Flat View  Flat View

Posted By:   mohammad_afzal
Posted On:   Friday, February 15, 2002 10:01 PM

I want to open a Msword or any other application by clicking a button placed on a Frame.

Please help me out. Thanks a lot.

Re: Opening a Msword document from Frame.

Posted By:   Paul_Connaughton  
Posted On:   Friday, February 22, 2002 08:13 AM

You are going to have to make some platform specific runtime commands in order to achieve this. Below is how you could do it to launch notepad, but the command used will depend on the file and application and underlying operating system. It is very unstable.

public class OpenNotepad {

private static final String APPLICATION_EXE = "notepad";

public OpenNotepad() {
openFileInNotepad( "C:\myFile.txt" );

public Process openFileInNotepad( String filename ){
return Runtime.getRuntime().exec( new String[]{ APPLICATION_EXE, filename} );
catch( Exception ex){
return null;

public static void main(String args[] ){
new OpenNotepad();

The only other help that I can offer is to take a look at this article which explains how to open an Internet Browser.


Hope this helps.

Paul Connaughton

About | Sitemap | Contact