Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5839941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:39:52+00:00 2026-05-22T11:39:52+00:00

I have following target in mz ant script to build my java application <target

  • 0

I have following target in mz ant script to build my java application

<target name="jar" depends="compile" description="generate jar">
    <jar jarfile="${build.dir}/jar/final.jar" basedir="${build.dir}/classes">
        <manifest>
            <attribute name="Main-Class" value="my.package.Main" />
        </manifest>
    </jar>
</target>

What I need is to somehow include log4j into the jar, as it throws a NoClassDefFoundError when running with

java -jar final.jar

What is the best way to achieve that?

Best,
Will

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:39:52+00:00Added an answer on May 22, 2026 at 11:39 am

    I could solve my problem with zipgroupfileset

        <jar jarfile="${build.dir}/jar/final.jar">
            <fileset dir="${build.dir}/classes" />
            <zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
            <manifest>
                <attribute name="Main-Class" value="my.pacakge.Main" />
            </manifest>
        </jar>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in my build.xml: <target name=compile.baz depends=init> <javac destdir=${build.dir}/classes debug=on> <compilerarg
I have following ant file to build. But unfortunately <project default=build.deploy.start basedir=.> <property name=target.dir
We have an ant build script for a project we're developing for a PDA.
I have the following in my pom: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ant-plugin</artifactId> <version>2.3</version> <configuration> <target> <echo
I have the following ant snippet <macrodef name=webapp.start> <attribute name=name /> <sequential> <!--deploy--> <antcall
I'm trying to use jstestdriver to generate some unit tests in my ant build
We build software using Hudson and Maven. We have C#, java and last, but
I have the following: $(document).ready(function() { window.location.href='http://target.SchoolID/set?text='; }); So if someone comes to a
I am rather noob at java jars deployment. I have following scenario: I have
I am working on an Ant build process for an application that uses a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.