Skip to main content

can't use JavaHelp packaged as a JAR inside my JAR

No replies
ask
Offline
Joined: 2003-06-13

I'm new to Javahelp, but with the documentation I managed to integrate JavaHelp 2.0 into my application. When I run my app inside my IDE (JBuilder 2005), everything works fine. As soon as I put the app into a jar file I get the following error message, as soon as I start the app:

Uncaught error fetching image:
java.lang.SecurityException: no manifiest section for signature file entry com/sun/java/help/impl/ViewAwareComponent.class

It seems to be related the manifest - file, but I jave no idea what to put in the manifest file or what is missing there.

Who can help? I've searched the forum but didn't find a related posting ....

Thnx very much in advance for your ideas!

note that running my app under JBuilder 2005 IDE is OK, the problem only arises when I execute my app outside JBuilder.

I tried several variants - I copied manifest.mf contents from jh.jar (JavaHelp version 2.02) - starting from lines
"Name: javax/help/BackAction$TimeListener.class
SHA1-Digest: HaHuvKSSUkN16nrsJjkkhXZi/Ik="...
- I added this content to the manifest file, which was generated by JBuilder 2005 Foundation. but when I try to run the new JAR file with my own manifest, it says:
-----------------------------------------------------
C:\Projects\test>java -jar test.jar
java.lang.SecurityException: invalid SHA1 signature file digest for javax/help/
--------------------------------------------

my JAR settings in JBuilder are "Include dependencies and resources".

another variant, which I tried -
I tried to include the whole jh.jar library to my JAR file instead of letting JBuilder to include separate classes ("include dependencies and resources"), but in that case Java can't find the JavaHelp classes, even if I specify this line in me manifest:
Class-Path: lib/jh.jar
so, I set up the JAR properties to "exclude all" and added "lib/jh.jar" file to the JAR using jbuilder's "JAR content" property.
after I build the JAR, jh.jar is located here:
------test.jar structure----
com
help
lib - this folder contains jh.jar
META-INF
my.xml

and after all this, java says:
java.lang.NoClassDefFoundError: javax/help/HelpSet
-----------------------------------------------------

my application CAN find javahelp classes if I just copy the directory "lib" with "jh.jar" to the same dir where my JAR is located:

--- jh.jar
myapp.jar

it works well. but when I remove the directory, the JAR file can't find the same library, which is included into that JAR.
my manifest.mf contains this line:
Class-Path: lib/jhall.jar

this page
http://java.sun.com/docs/books/tutorial/jar/manifest/downman.html
says:
Note: The Class-Path header points to classes or JAR files on the local file system, not JAR files within the JAR file or classes on the network. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path.
----------------------

so, I have to either write a custom class loader (GOD knows how to do this!) or just include the contents of jh.jar instead of including the whole jh.jar file to my JAR.
but including "dependencies and resources" will lead to the same problem, which is described above... ehh...

so, I'd like to include jh.jar into my own JAR-file - does anyone have an example how to use jh.jar classes in this situation (I suppose, this example must be based on a new classloader implementation)?