I developed two .jar for my application (LOG.jar and STRING.jar).
I use these jar, with import in .java :
import LOG.CLog
import STRING.CString
It’s OK. But .jar is increasing in my project, so I would like to create only one .jar which includes all .jar developed.
So I tried this by creating the only one .jar (named TOOLS.jar) :
jar.exe cvmf MANIFEST.MF TOOLS.jar TOOLS\LOG.jar TOOLS\STRING.jar
But, if I put only TOOLS.jar file in my application compilation (Java build path in Eclipse), I get error when I want to import :
import TOOLS.LOG.CLog
This import cannot be resolved.
And In Eclipse “referenced libraries”, I see package PXTOOLS which includes both STRING.jar and LOG.jar, but I don’t see STRING and LOG package !
How can I fix it ?
You import classes by qualifying them with package names; not directly from JAR files. I hope your package is called
LOGand class isCLoghere (though it’s a bad naming convention to have uppercase package names)Secondly, merging JAR files into one isn’t recommended. It’s best to keep them separate. If at all you did want to merge, you must ensure that you extract all the class files first and then merge.