javaeclipseclasspathjavahelp

findHelpSet return a null URL while integrating JavaHelp system inside my application using Eclipse


I'm trying to include JavaHelp inside my application developed under Eclipse.

I did the following things:

  1. Download and extract the JavaHelp library in a sub-folder of my project workspace.
  2. Added the following library's JARs to my project class path (Properties->Java Build Path->Libraries->Add External JARs):

    jh.jar

    jhall.jar

    jhbasic.jar

    jsearch.jar

  3. I tried to create both folder (New->Folder) called help_folder and a Source Folder (New->Source Folder) called help_source_folder, and put inside them a file of example called Master.hs (I took it from the JavaHelp archive).

Then from inside my application I did the following:

try {
    ClassLoader loader = this.getClass().getClassLoader();
    URL url = HelpSet.findHelpSet(loader, "Master.hs");
    //alternatively : URL url = HelpSet.findHelpSet(loader, "help_folder/Master.hs");
    //alternatively: URL url = HelpSet.findHelpSet(loader, "help_source_folder/Master.hs");
    JHelp jhelp = new JHelp(new HelpSet(loader, url));
} catch (HelpSetException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

Now the problem is the following: HelpSet object cannot be created because a null URL is returned by findHelpSet() method.

I have no idea on how solve this. Can someone put me in the right direction?


Solution

  • Make sure the folder you create is inside your project's source folder (defaults to 'src'). If it's not then it won't be included in the output folder (defaults to 'bin') when it builds the project.