Skip to main content

Classpath problem (I think) ... Not!

3 replies [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Bob Marcum

Actually, it is and it isn't a classpath problem. It is really a
jar/classpath
problem. That is, I can run the application and the help system (as
context
sensitive help) when the application is unjarred. The jarred application

seems oblivious to any classpath setting on the commandline.

By working with the application unjarred, I have been able to complete
the JavaHelp system and code its integration into the application.

Now, I will have to find a way to control classpath in the jarred
application.
I think I may have a way to do that; I am going to try to set classpath
programatically from the constructor of the class containing the
application-driving main. I am going to try to set the classpath as
an environment property in the JVM's properties. Maybe that will work.
Stay tuned.

On the other hand, if any of you have encountered and solved this
problem,
please let me hear from you.

>
> Bob Marcum wrote:

> I am pulling my hair tyring to sort this out. Please Help.
>
> I have a application running from an executable jar file.
> I have a help system authored and which I can exercise using hsviewer.
> I (first) want to display the help system by clicking on a MenuItem
> in the running application. I have a very few things I have yet
> to complete in the help system (one TOC item). I have included
> the code in my application to find and invoke the helpset from the
> MenuItem. I took the code, effectively, right out of the hs users
> guide. It works ... that is, when I comment out a System.exit
> in the catch block of finding the helpset, I can force a null
> pointer exception when I click on the MenuItem because the code
> could not find the helpset.hs
>
> I do get a report from the catch block of the findHelpSet that says
> clearly it did not find the HelpSet.
>
> I have tried just about everything I can imagine as ways of specifying
> the classpath upon invocation of the application. It is as if
> I never specified classpath on the java commandline.
>
> The helpset is in a nearby (from where I am invoking the application)
> directory.
>
> I am attempting to invoke the application and specify the classpath to
> the helpset by the following command:
>
> java -cp docs/MyAppHelp -jar myapp.jar arg1
>
> The myApp.hs is in the docs/MyAppHelp directory along with the rest of
> the helpset control files.
>
> Suggestions, please?

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

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.

Bob Marcum

I have learned enough to simplify the issue.

I have an application running from a executable jar file. I have coded the
application to use JavaHelp, as such it requires classpath access to jhbasic.jar.
I want to package the jhbasic.jar inside the executable jar file, to simplify
deployment and use by the user.

How can I arrange classpath to allow the running application to see a jhbasic.jar
inside the executable jar? The running application has to be able to see inside
its own navel ... sort of.

Simple enough question but I haven't worked out an answer yet.

Anybody?

This has now come down to being a jar problem, mainly, and not so much a JavaHelp
problem.

Thanks.

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

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.

Bob Marcum

I have finally sort this out. Essentially, you cannot access a jar within a jar
from an executable jar.

No kidding! I have tracked through the tutorials and the forums on java.sun.com
The Jar and java extension mechanism forums are full of messages from folks who want
to be able to package up third party JARs in with their executable application which
use these third party JARs. The answer from someone on the jar extension technology
team is ... It can't be done! ... It would be bad practice, even if you could! (he
says)

Apparently, one might be able to achieve this end by writing a custom class loader.
I for one do not have that time nor interest to extend beyond what is available in
java as a standard capability.

The best one can do, given the current state of the technology, is to package up the
third party JARs in an enclosing jar which is used just for distribution and then
unpack the distribution jar so the third party jars get sprayed out ont the disk
where the executable jar can find them. Use the extension mechanism (add a
Class-Path parameter to the Manifest of the executable jar) to tell the executable
jar where to find the JARs now out on disk.

Okay. I give up. If that is the best I can do, I've done it!

> I have learned enough to simplify the issue.
>
> I have an application running from a executable jar file. I have coded the
> application to use JavaHelp, as such it requires classpath access to jhbasic.jar.
> I want to package the jhbasic.jar inside the executable jar file, to simplify
> deployment and use by the user.
>
> How can I arrange classpath to allow the running application to see a jhbasic.jar
> inside the executable jar? The running application has to be able to see inside
> its own navel ... sort of.
>
> Simple enough question but I haven't worked out an answer yet.
>
> Anybody?
>
> This has now come down to being a jar problem, mainly, and not so much a JavaHelp
> problem.
>
> Thanks.
>
> ********************************************************************************
>
> 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.

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

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.