Java Code:
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Display;

public class Snippet30 {

  public static void main(String[] args) {
    Display display = new Display();
    Program p = Program.findProgram(".txt");
    if (p != null)
      p.execute("c:\\autoexec.bat");
    display.dispose();
  }

}