java - how to put folders inside a jar file into the classpath? -


i mantaining old java application has dcm4che library. dcm4che library not jar file. folder contains jar files , other folders properties files , classes in different folders. using windowsxp , java 1.6.

when run our application, need put folders, jar files classpath doing these:

set classpath=.;%proj_home%\classes;^ %thirdparty_home%\dcm4che;^ %thirdparty_home%\dcm4che\classes;^ %thirdparty_home%\dcm4che\resources;^ 

now try put of them 1 jar file simplify sources control. create manifest.txt file following content:

class-path: classes;resources;lib\dcm4che.jar;getopt.jar 

then create dcm4che.jar running jar:

jar -cfm dcm4che.jar manifest.txt * 

a dcm4che.jar created. verify result extracting contents , check manifest file , classpath there:

manifest-version: 1.0 class-path: classes;resources;lib\dcm4che.jar;getopt.jar created-by: 1.6.0_25 (sun microsystems inc.) 

then modify application classpath point new generated dcm4che.jar , delete older entries.

when run it, noclassdeffounderror. class under classes folder inside new created jar file.

i missing anything?

java not support jars in jars. so, easiest way expand file , add content classpath. think can using script. anyway have script runs application, right? add several lines expand file temporary or user home directory.

if not want or forbidden other reasons have implement own classloader loads cliesses nested jar. not hard requires efforts. can use vfs jakarta. simplify implementation.

but i'd recommend first way.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -