how to call 3rd party jar that exist in lib directory of the main class jar

hi,

I have created custom.jar and inside custom.jar there is lib directory where placed 3rd party jars.but Test class inside in custom.jar is not picking up 3rd party jars that exist in lib directory.how to resolve this issue?

custom.jar
|
|
lib ----
		|
		log4j.jar
		

		manifest file.		
		
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 17.0-b17 (Sun Microsystems Inc.)
Main-Class: com.sample.Test
Class-Path: lib/log4j.jar

Open in new window

LVL 20
chaitu chaituAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
As I know it is plugin for Maven, but I think that you can use it with Ant as well...
It's  Maven 'Shade' you're thinking of. If you're using Eclipse, simply include your jar as a dependent library and its export facility will create a 'fat jar'
0
 
ksivananthCommented:
just add that jar into classpath!
0
 
chaitu chaituAuthor Commented:
in the manifest file its there right..this jar is located inside the lib directory custom.jar.so jar inside jar.

Class-Path: lib/log4j.jar
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
ksivananthCommented:
I don't think jar inside jar will work, you may want to extract it out.
0
 
chaitu chaituAuthor Commented:
0
 
ksivananthCommented:
probably!
0
 
ValeriConnect With a Mentor Commented:
yes, one-jar is what you need! :-)
As I know it is plugin for Maven, but I think that you can use it with Ant as well...
0
 
CEHJCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.