I need clarification from the boss. I had a zip file that could be extracted into a working program - lib directory, resources dir, etc. But the boss said he wanted to deploy a jar file. And I assume he meant an executable jar file, given he didn't care for my zip approach.
So this leaves me in a quandary about what he intended to do with all those jar files I need... perhaps they are there on the disk already... Or he expects a one-time copy of jar files. Blech.
Currently my ant task extracts the library jars into a tmp directory tree then includes that tree as a fileset in the jar task :-D
Takes forever to build that jar...
Tony Ennis wrote:I need clarification from the boss. I had a zip file that could be extracted into a working program - lib directory, resources dir, etc. But the boss said he wanted to deploy a jar file. And I assume he meant an executable jar file, given he didn't care for my zip approach.
Most of the time I see people asking about deploying a single jar file, it's people who don't really understand deployment. Or who have unrealistic requirements for it, let's say.
If you want the full top-of-the-line professional approach, then get yourself something which makes installers for the environment you're targeting, then distribute the installer. There are Java-specific installer-makers, I believe, but again I've never had a need to use such a thing.
If you want a quick-and-dirty approach, then just send out your jars with instructions to plunk them all into the same directory. If you're going to do an executable jar then make sure its manifest is set up to assume that's done. Otherwise send out a batch script which starts the main class and sets up the classpath accordingly.
The first approach would be targetting non-technical users. That way they get something they are used to and don't have to struggle with directories and so on. The second approach would be targetting users who know about directories and batch scripts and so on. These people don't need One Big Jar, they can deal with three or four jars or even a zip file. The first group probably couldn't even deal with One Big Jar. There might be a group in between those two who can deal with one jar but can't deal with more than one jar, but I doubt you'll find people like that very often.
Be that as it may, I have made reasonable changes to the manifest to specify a classpath relative to the deployment directory.
I am only slightly thwarted now. My resource directory doesn't seem to be on the classpath even though I added it to the manifest along with 50 jars. Does Class-Path in the manifest only work with jar files?
The fileset collects all the jars in my lib directory.
The Pathconvert smashes then into a space-sep string.
The Map within Pathconvert removes all my personal path information, making the remainder relative.
Later, in the zip task,
Jams the space-sep list of jars into the manifest. I couldn't find a way to wildcard it.
Season to taste, ymmv, yadda.