Opening a CHM help file from a Java program

Courtesy of Daniel Whitworth, the following Java code assumes the CHM help file is located in the same directory as the program being run:

File file = new File("help.chm");
try
{
  Runtime.getRuntime().exec("HH.EXE ms-its:" + file.getAbsolutePath() + "::/TOPIC_ID.html");
} catch (IOException e1)
{
  e1.printStackTrace();
}

The highlighted parts should be customized according to your needs:

  • help.chm: This is the CHM help file you would like to open 
  • TOPIC_ID: This is the topic ID you would like to open