Re: Nine ways of identifying Class-Path in manifest that don't work
On 12/23/2009 11:16 AM, Composer wrote:
I've read several posts about Class-Path and they generally seem to
assume that I know how to specify the location of a directory relative
to the directory of the jar being executed. I'm running OS X.
The jar to be executed is
The external jar containing classes I need is
So the external jar file is two directories up and then one directory
down from my main jar.
The compiler is perfectly happy finding the classes in mail.jar.
If I explicitly load all the classes from mail.jar into
DesktopApp.jar, it executes fine.
Here are the variants I have tried in my manifest:
All nine of these attempts result in NoClassDefFoundError when I
Am I being really stupid?
Relative paths to included jar files always struck me as problematic
because it depends on your current directory to determine relative path.
That said, assuming you are executing from the /Java projects
directory, I think Patricia has your fix. But a couple of things to
remember, the manifest file must end with a new line/carriage return or
it won't work correctly.
From the jar docs:
The value of this attribute specifies the relative URLs of the
extensions or libraries that this application or extension needs. URLs
are separated by one or more spaces. The application or extension class
loader uses the value of this attribute to construct its internal search
So I don't know for sure whether you could specify
/Java projects/javamail/mail.jar but I suspect that would work also
and might work out better if you are going to deploy the entire
directory tree. If not, I wouldn't use a path but just the .jar file
name in the Class-Path entry and deploy everything to the same directory.
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access