Vighanesh Gursale
Vighanesh Gursale

Reputation: 921

how to use jar files

I have create an jar file containing external jar files using command prompt. But after creating that jar file I can't access the jar files inside the main jar files. I don't know whether the folder structure has been changed or any other problem.

Command used in command prompt:

C:\diretory>jar cf mycollection.jar *

'*' - for including all the jar files in folder.

I am just trying to make a single jar file of all the external files I need in my project. It was successfully build but while using it given ClassNotFoundException. I giving you now full scenario of my problem. Actually I am trying to add all external look and feel jar into single jar file so I don't need to put each and every jar individually. So I created a jar file consisting all the external look and feel jar files. And now while using it like import statement it show no such class is there in my jar file.

Upvotes: 2

Views: 129

Answers (2)

Lenymm
Lenymm

Reputation: 901

As I'm working with Maven projects I'm using Maven's goal assembly:assembly in order to pack all the files into one (build with dependencies).

Also NetBeans offer "build with dependencies" option might want to check that out as well...

Upvotes: 0

MadProgrammer
MadProgrammer

Reputation: 347184

Java does not supported embedded Jars. I know, pain.

You could try using something like One-Jar which allows you to embedded multiple Jars into a single "master" Jar, but I had problems with custom classloading, but you might have better luck...

Upvotes: 2

Related Questions