Jar problem

D

Daniel

Hi all!
I'm using JBuilder X to help me make executable jars. Anyway I've now
decided to include help pages in javahelp format. So far so good. As I
would like to have just one jarfile I thought I'd configure JBuilder
to include "all dependecies" from the javahelp lib. And sure it puts
all the files there, BUT the file is not executable! Or actually it
is, but I get a security exception. If I reduce the include filter to
"used classes and known resources" the file is executable but I can
not view any help pages. Can someone help me here? What am I missing?

the exception I get is:

Exception in thread "main" java.lang.SecurityException: invalid SHA1
signature file digest for javax/help/
at
sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:321)
at
sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:172)
at
java.util.jar.JarVerifier.processEntry(JarVerifier.java:239)
at java.util.jar.JarVerifier.update(JarVerifier.java:194)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:300)
at java.util.jar.JarFile.getInputStream(JarFile.java:362)
at
sun.misc.URLClassPath$5.getInputStream(URLClassPath.java:616)
at sun.misc.Resource.getBytes(Resource.java:57)
at
java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

regards
Daniel
 
S

SPG

Daniel said:
Hi all!
I'm using JBuilder X to help me make executable jars. Anyway I've now
decided to include help pages in javahelp format. So far so good. As I
would like to have just one jarfile I thought I'd configure JBuilder
to include "all dependecies" from the javahelp lib. And sure it puts
all the files there, BUT the file is not executable! Or actually it
is, but I get a security exception. If I reduce the include filter to
"used classes and known resources" the file is executable but I can
not view any help pages. Can someone help me here? What am I missing?

the exception I get is:

Exception in thread "main" java.lang.SecurityException: invalid SHA1
signature file digest for javax/help/
at
sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:321)
at
sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:172)
at
java.util.jar.JarVerifier.processEntry(JarVerifier.java:239)
at java.util.jar.JarVerifier.update(JarVerifier.java:194)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:300)
at java.util.jar.JarFile.getInputStream(JarFile.java:362)
at
sun.misc.URLClassPath$5.getInputStream(URLClassPath.java:616)
at sun.misc.Resource.getBytes(Resource.java:57)
at
java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

regards
Daniel

Hi Daniel,

Some external jar files are built so that you cannot include them inside
another jar file.
I would suggest that you do not import the contents of the help jar into
your jar, but simply distribute the jar with your package and add it to the
classpath when you run the app..

Steve
 
D

Daniel

Hi Daniel,

Some external jar files are built so that you cannot include them inside
another jar file.
I would suggest that you do not import the contents of the help jar into
your jar, but simply distribute the jar with your package and add it to the
classpath when you run the app..

okay, that sounds okay to me. So I distribute it in the form of two
jars. When I try this it refuses to find any javax.help classes.
I added this to the mainmethod before any object creation to help
solve this problem:
System.setProperty("java.class.path",System.getProperty("user.dir")+"\\jh.jar;"+System.getProperty("java.class.path"));

but it doesn't help. So how do I specify that the classpath includes
the "external" jar?
I have tried to put ".;./jh.jar" in the manifiest file but it doesn't
help either..

In an ideal world I wouldn't have to ask the user to do anything, but
run the program, no setup or anything, is that not possible?

/daniel
 
S

SPG

Daniel said:
okay, that sounds okay to me. So I distribute it in the form of two
jars. When I try this it refuses to find any javax.help classes.
I added this to the mainmethod before any object creation to help
solve this problem:
System.setProperty("java.class.path",System.getProperty("user.dir")+"\\jh.jar;"+System.getProperty("java.class.path"));

but it doesn't help. So how do I specify that the classpath includes
the "external" jar?
I have tried to put ".;./jh.jar" in the manifiest file but it doesn't
help either..

In an ideal world I wouldn't have to ask the user to do anything, but
run the program, no setup or anything, is that not possible?

/daniel

Daniel,

I think you need to add this to your manifest..

Class-Path: <your relative path here>/jh.jar


It may be that this jh.jar also has other external deps though.

Steve
 
D

Daniel

Daniel,

I think you need to add this to your manifest..

Class-Path: <your relative path here>/jh.jar
I have tried that. I tried with ./ (since it is in the same dir as the
executable jar) but it doesn't work.
It may be that this jh.jar also has other external deps though.
possible, but from the documentation it says it contains all I need.
also I made a .bat file that contains the classpath and the jh.jar and
does not run a jar-file but my mainclass directly, and it works.

so it seems that it is some problem with the relative path.
I'm not entireley sure how this works.
in the manifiest . means the jarfile itself. so how do I reference a
different file in the same dir as the jar-file?
I just tried with ../jh.jar thinking that maybe that would reference
the dir just ourside the jar, but it did not work either.
I'm quite at loss here.

/daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,261
Messages
2,571,040
Members
48,769
Latest member
Clifft

Latest Threads

Top