Using Java, how do I cause Word to open and edit a file? [duplicate]

Here is the simple Demo App , you can modify it for button click event :

import java.awt.Desktop;
import java.io.File;
import java.io.IOException;

public class Test {
 public static void main(String[] a) {
   try {
     if (Desktop.isDesktopSupported()) {
       Desktop.getDesktop().open(new File("c:\\a.doc"));
     }
   } catch (IOException ioe) {
     ioe.printStackTrace();
  }
}

}

This would open word file with default word application .
More detail here for Desktop

Leave a Comment