I’ve been trying to run a jar file – let’s call it test.jar – that uses the Sybase jconn3.jar on a Unix system.
I have created a MANIFEST.MF file that has the following:
Class-Path: $SYBASE/jConnect-6_0/classes/jconn3.jar commons-net-1.3.0.jar
This gives a ClassNotFoundError. $SYBASE is the system variable that points to /opt/sybase13; I’ve also tried the following:
Class-Path: /opt/sybase13/jConnect-6_0/classes/jconn3.jar commons-net-1.3.0.jar
and
Class-Path: opt/sybase13/jConnect-6_0/classes/jconn3.jar commons-net-1.3.0.jar
However, if I copy the jconn3.jar file from the $SYBASE/jConnect-6_0/classes to the same directory as test.jar, and update my MANIFEST.MF to read as follows:
Class-Path: jconn3.jar commons-net-1.3.0.jar
The application runs as expected.
Now, I’ve been able to verify the jconn3.jar file works by copying it locally; my MANIFEST.MF file includes the path to my Main-Class, so that’s not at issue here.
What do you think could be the problem? I’ve been looking at this thing for too long now. Thanks!
The entries in the class-path are either relative to the JAR in which they are embedded (which you have working) or are URLs. To make your absolute paths work, you’ll need to convert them to URLs, e.g.,
file:/opt/sybase13/...There’s no mechanism for using variables.
Although the JAR specification doesn’t say it clearly, absolute
file:scheme URLs do work in the class-path attribute.