[PJUG Javamail] Packaging Java Applications

Aaron Getz getza1 at gmail.com
Tue Aug 11 22:44:34 UTC 2009


Dan,
  If it is just a basic project then it should consist of really two
components

    lib folder to hold 3rd party libraries
    src folder where your java code is

    I have created a basic ant script that will take this scenario and
compile your source code.  Then you would want to either create another
target called "dist" or add the Ant jar task to the "build" target to create
a jar file of your compiled source code.

<project name="foo" basedir="." default="build">

    <path id="project.classpath">
        <fileset dir="lib" includes="**/*.jar"/>
    </path>


    <target name="build">
        <javac srcdir="src" destdir="bin" debug="true"
debuglevel="source,lines,vars">
            <classpath refid="project.classpath"/>
        </javac>
    </target>
</project>

You can then run that Ant build file from the command line, given that you
have the source and the dependent libraries needed to compile the code.

Hope that helps.

Aaron


On Tue, Aug 11, 2009 at 3:33 PM, Dan Colish <dan at unencrypted.org> wrote:

> I'm really not that interested in a runable jar, thats pretty easy to
> produce within eclipse. I'm trying to properly setup a java project that
> uses external libraries and builds correctly without requiring eclipse.
> My main concern is the directory structure for the project and any build
> files that are required. I have looked at the ant build.xml files, and I
> am working on that currently, but that is really complex.  Even if I
> can't do this without eclipse, I am confident there is a proper way to
> do this that does not require an couple hours of setup.  I've gotta be
> doing something wrong here. The current project is a simple one, but I
> would like to understand the correct way to do this for future projects.
>
> --
> --Dan
>
>
>
> On Tue, Aug 11, 2009 at 03:23:09PM -0700, Kent Spaulding wrote:
> > Ant is one means - if all you care about is the executable then use
> > eclipse's 'Runnable Jar' feature.
> >
> > For you project, click File|Export.. and in the treeview select as in
> > the attached screenshot.  It will allow you choose what to bundle.
> >
> > If your version of eclipse doesn't do this, there is a plugin called
> > FatJar that will (which is where this feature came from)
> >
> > The resulting jar file is run as:
> >
> > java -jar myjar.jar <arguments>
> >
> > --Kent
> >
>
>
> _______________________________________________
> Web Site - http://www.pjug.org/
> Javamail mailing list
> Javamail at pjug.org
> http://www.pjug.org/mailman/listinfo/javamail
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://javac.com/pipermail/javamail/attachments/20090811/6212e11b/attachment-0002.html>


More information about the Javamail mailing list