Thursday, September 17, 2009

Launching CHM help file from a Java application on Windows

Seems like an obvious need but could not find an example for how to launch a compiled HTML help file from inside a Java JAR application on a Windows machine, so here's one:

String myHelpfile = path + "help.chm";
String[] command = { "hh.exe", myHelpfile };
try {
Process proc = Runtime.getRuntime().exec(command);
} catch (IOException e) {
e.printStackTrace();
}