Skip to main content

Packaging with Jar files

4 replies [Last post]
dacagl
Offline
Joined: 2007-08-07
Points: 0

We are looking to package all our documentation into a Jar in our next release and I was wondering what the preferences were from some other people. According to the JHUG, we can package all of our files into the Jar or leave the helpset and/or map file independent. Is there a better way to go? It seems like the JHUG hints at leaving only the helpset file independent as a better approach.

Also, does the helpset file have to be at the top level of the Jar, if it is included in it, or can it be buried in a directory?

Finally, we might run into problems too because our documentation consists of 20 or more helpsets, so if all of them are in one Jar file, I don't know how JavaHelp will be able to find one particular helpset.

Any ideas? Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dacagl
Offline
Joined: 2007-08-07
Points: 0

How would the code to access a helpset in a Jar look? I'm having problems accessing the helpsets files from a class in another Jar file, but if the test class is not in a Jar, everything works. I think it might have something to do with the ClassLoaders, but I am not sure at all. Here is the scenarios:

JavaHelp displays correctly in this scenario:
- Documentation lives in doc.jar
- Standalone java class to access JavaHelp is SwitchingTest.java (at same level as doc.jar)
- jh.jar contains jh_2.0.1
- Run java with the command...java -cp ".;doc.jar;jh.jar" SwitchingTest

JavaHelp does not display correctly in this scenario:
- Documentation lives in doc.jar
- Java class which access JavaHelp lives in app.swing.jar and depends on code in app.core.jar
- jh.jar contains jh_2.0.1
- Run java with the command...java -cp ".;doc.jar;jh.jar;app.core.jar;app.swing.jar" JarTest

The code I use to find the helpset is:
ClassLoader c1 = this.getClass().getClassLoader();
URL hsURL = HelpSet.findHelpSet(c1, "doc/en/console/config/console.hs");
HelpSet hs = new HelpSet(c1, hsURL);

hsURL comes across as null for the 2nd scenario and I can't figure out why. I'm guessing it has something to do with the class being inside of the sas.swing.jar and trying to access the helpset in another Jar?

brinkley
Offline
Joined: 2003-06-06
Points: 0

>The code I use to find the helpset is:
> ClassLoader c1 = this.getClass().getClassLoader();
> URL hsURL = HelpSet.findHelpSet(c1,"doc/en/console/config/console.hs");
> HelpSet hs = new HelpSet(c1, hsURL);

Most likely the problem in the way you jarred up doc.jar. The directory path doc/en/console/config must be in the jar file.

Binky

Roger Brinkley

java-help@JAVADESKTOP.ORG wrote:
> We are looking to package all our documentation into a Jar in our
> next release and I was wondering what the preferences were from some
> other people. According to the JHUG, we can package all of our files
> into the Jar or leave the helpset and/or map file independent. Is
> there a better way to go? It seems like the JHUG hints at leaving
> only the helpset file independent as a better approach.
>
> Also, does the helpset file have to be at the top level of the Jar,
> if it is included in it, or can it be buried in a directory?
>
> Finally, we might run into problems too because our documentation
> consists of 20 or more helpsets, so if all of them are in one Jar
> file, I don't know how JavaHelp will be able to find one particular
> helpset.
>
> Any ideas? Thanks!

Either Jar it or don't, but don't mix.

Binky

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

larry hoffman

java-help@JAVADESKTOP.ORG wrote:
> We are looking to package all our documentation into a Jar in our next release and I was
> wondering what the preferences were from some other people. According to the JHUG, we can package
> all of our files into the Jar or leave the helpset and/or map file independent. Is there a better way to go?
> It seems like the JHUG hints at leaving only the helpset file independent as a better approach.

This really depends on how you deploy your product. If the helpset is located on
a server and accessed remotely by the application, you definitley do not want to
package the helpset into a JAR file. If you do, the entire JAR file is
downloaded the first time the help is accessed. If you leave it unJARed only the
requested topic file is downloaded. If the helpset is local, there is no real
penalty for packaging the help into a JAR file and it is far more convenient.

Larry

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.