• Post Reply Bookmark Topic Watch Topic
  • New Topic

jar inside jar.  RSS feed

 
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Can anybody guide me step by step process for creating jar file which uses thired party jars.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you consider a war , then you will see that the lib directory under WEB-INF contains jars , so its like jar within a jar.
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but in this case... this is not a web application.

my Project which is named Reporting which contains one .java file(AutoReport.java)

which fire one query create one .xls file and send mail.

so want to create an executable jar file for it...
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Rahul said, a jar file is a file like any other, so it's no problem to create a jar file that contains other jar files.

But... this won't help if the inner jar files contain classes that should be loaded, because the ClassLoader will not recurse into jar files inside of jar files. Your options are either to un-jar everything, and build a single jar file out of all classes, or to ship several jar files, and reference them from the main jar file via the "Class-Path" setting in the manifest.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jigar Naik:
so want to create an executable jar file for it...


I have seen this topic n times in javaranch


Check this link
 
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:

But... this won't help if the inner jar files contain classes that should be loaded, because the ClassLoader will not recurse into jar files inside of jar files. Your options are either to un-jar everything, and build a single jar file out of all classes, or to ship several jar files, and reference them from the main jar file via the "Class-Path" setting in the manifest.


Or to use http://one-jar.sourceforge.net/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!