1

I have created jar file for my project. It is running successfully. There is one 'lib' folder. I have other jar files in this folder. I added all these jar files in MANIFEST.MF in the jar as follows:

>>Class-Path:jar file names .... ...  ....

I run jar file as follows:

>>java -jar jarfile.jar arguments...

but problem is that I need to put this jar file where the 'lib' folder is located, and if i want to run this jar on others machine,then i need to give this jar folder along with 'lib' folder.

but I dont want to give this jar along with 'lib' folder.

And when I try to put this jar outside the 'lib' folder,it is not working.

I have to give this only jar folder to other machine.so I can run my jar file on others machine.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
swarup7m
  • 183
  • 1
  • 2
  • 12
  • so when you had decided not to share your jar,did u give your complete path to the other machine..like \\machinename\sharedfolder\jarname. – GustyWind Jan 27 '11 at 13:37

1 Answers1

4

I'm sorry to tell you, but unless you implement your own custom class loader, you can not nest jar-files like that in Java. See for instance this discussion.

You could however merge your jar files using tools such as One-Jar.

Related answer.

(woho, this was my 1000th answer :)

Community
  • 1
  • 1
aioobe
  • 413,195
  • 112
  • 811
  • 826
  • I also think One-Jar is what is needed here. If this is a maven project, then the maven-assembly-plugin can do a similar job. – rompetroll Jan 27 '11 at 13:40