Search code examples
javaswingnetbeansnoclassdeffounderror

Why do I get a HelpSetException - NoClassDefFoundError when trying to run a Swing desktop application?


The application and the help system runs ok from the netbeans IDE but when deployed the exception is returned on the help set. I have checked that the three help jars jh.har, jhall.jar and jhbasic.jar are in the project > Properties > Libraries > Compiling. I have checked the contents of the distribution created from the NetBeans and verified that the three help files are in the lib folder. I have checked and verified that the Windows 8.1 CLASSPATH includes:

    CLASSPATH=C:\Program Files\Java\jdk1.8.0_72\bin; 
    D:\jh2.0\javahelp\lib; 
    D:\jh2.0\javahelp\bin     

This is the dump from the run:

    C:\Program Files (x86)\NewDawn4>java -jar Newdawn.jar
    Error: A JNI error has occurred, please check your installation and try again
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/help/HelpSetException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: javax.help.HelpSetException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more 

Having researched this problem in depth and followed the recommendations of others, I am still without a solution and unable to see what I am doing wrong.


Solution

  • Try setting classpath in manifest:

     Class-Path: lib/jh.jar lib/jhall.jar lib/jhbasic.jar