Ethan
Ethan

Reputation: 1266

Including a jar within a jar in Eclipse? (Without making the JAR runnable)

HI I've found myself referencing a JAR archive I made awhile ago in my code. But the JAR I made has references to the JSoup JAR file, which I just discovered is not automatically added as I had assumed it was (stupid assumption). So after looking around Stack-Overflow it seemed that by simply adding some Class-Path information to a custom Manifest I could solve my problem...But I still get a ClassDef error when I try and reference my JAR from the other project.

Manifest-Version: 1.0
Class-Path: "C:\Users\ethan\Documents\ACTUAL My Documents\Libraries\Java Libraries\jsoup\jsoup-                1.6.3.jar"

SO I'm not sure if I wrote the manifest wrong. (I tried with and without quotes, neither worked). I don't have ANY experience in writing manifests, my knowledge came from this post on stackoverflow

Eclipse: How to build an executable jar with external jar?

from McDowell's post.

I've seen a lot of posts suggest using Maven, or a third party application. But it seems like there should be some simpler way to make this happen in Eclipse without installing anything new (as this often can bring on new headaches).

Upvotes: 0

Views: 127

Answers (1)

Thilo
Thilo

Reputation: 262814

The Class-Path in the Manifest is only used when you run an executable jar. It won't be used for jar files used as libraries. You will have to tell your main JAR file about it, too.

Upvotes: 1

Related Questions