[PJUG Javamail] Packaging Java Applications
Zack Radick
zack at crc-corp.com
Tue Aug 11 17:41:20 EDT 2009
Dan,
If you are using Ant for your build, check the Ant docs regarding the
"Jar" and "Manifest" core tasks
(http://ant.apache.org/manual/index.html). A manifest file is meta
information for the jar to declare dependencies and other packaging
information, such as the main class to run (so that a user can double
click the jar to run it or execute it with a "java -jar myjar.jar"
command). Jar files do not typically include other jar files that
they depend on. These are usually included in a library directory,
so you probably want to package your end product as a zip which
includes the executable jar, a directory of it's library files, and
any other runtime stuff you feel may be needed (docs?).
--Zack
At 02:32 PM 8/11/2009, Dan Colish wrote:
>Well, I'm just trying to package it so a user can clone my git repo and
>easily build the source. This is not an eclipse plugin. It's just a
>standard cli application. I'd like to include the dependency since its
>licensed to allow that. FYI, the dependency is joda-time.
>
>Does packaging into a jar allow this? I'm a little confused by the end
>purpose of a jar. Also, if I do this outside of eclipse even better.
>I've looked it ant, and it's what I am currently using to do the builds.
>
>--
>--Dan
>
>
>On Tue, Aug 11, 2009 at 02:18:29PM -0700, Aaron Getz wrote:
> > Hey Dan,
> > I guess it depends on what you are initially trying to package up. Is
> > this an Eclipse plugin? If so then you can just highlight the project and
> > right click and then choose to export it and the PDE builder of
> Eclipse will
> > handle the rest.
> >
> > In the case of a Eclipse plugin you would include the 3rd party
> lib in the
> > jar file you create.
> >
> > If you are just looking to create a jar file that is your source code and
> > then the consumer of your jar file is responsible for getting the
> > dependencies needed for using your jar file. If you want to include the
> > jars along with your jar file then you can classpath the jars in your
> > manifest file and make sure the user of your jar puts them in the path you
> > specified or they can create their own classpath.
> >
> > Here is a good tutorial on jar files from Sun
> > http://java.sun.com/docs/books/tutorial/deployment/jar/
> >
> > And here is another document on setting the classpath
> > http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html
> >
> > I hope that helps out.
> >
> > Aaron
> >
> > On Tue, Aug 11, 2009 at 2:09 PM, Dan Colish <dan at unencrypted.org> wrote:
> >
> > > So I need to packaage up some source code in an Eclipse project for
> > > sharing. Normally, I'd just point someone to my git repo, but I have
> > > included external libraries in my project. I'm now having some trouble
> > > figuring out how to deal with this. Do I include that jar too? If so how
> > > does the person run that without extensive setup? Isn't there a simple
> > > way to include libraries like in C/C++ where I have an include and a
> > > compat dir, then just link against them in my makefile? I'm new to Java
> > > packaging so any help is appreciated.
> > >
> > > --
> > > --Dan
> > > _______________________________________________
> > > Web Site - http://www.pjug.org/
> > > Javamail mailing list
> > > Javamail at pjug.org
> > > http://www.pjug.org/mailman/listinfo/javamail
> > >
>_______________________________________________
>Web Site - http://www.pjug.org/
>Javamail mailing list
>Javamail at pjug.org
>http://www.pjug.org/mailman/listinfo/javamail
More information about the Javamail
mailing list