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

  • Home
  • SEARCH
  • 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 990821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:00:16+00:00 2026-05-16T06:00:16+00:00

I have written an ANT script and finally am building the jar here is

  • 0

I have written an ANT script and finally am building the jar

here is the building of jar section

<jar jarfile="${destination}/@{name}.jar">
     <fileset dir="${output}">
         <include name="abc/xyz/@{name}/**"/>
     </fileset>
     <zipfileset dir="lib" prefix="lib/"/>
     <manifest>
          <attribute name="Main-Class" value="com.abc.xyz.HelloWorld"/>
          <attribute name="Class-Path" value=".:lib/activation.jar:lib/antlr-2.7.6.jar:lib/asm-attrs.jar:lib/asm.jar:lib/cglib-2.1.3.jar:lib/commons-collections-2.1.1.jar:lib/commons-logging-1.1.jar:lib/dom4j-1.6.1.jar:lib/ehcache-1.2.3.jar:lib/ejb3-persistence.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/hibernate-tools.jar:lib/hibernate3.jar:lib/javassist.jar:lib/jdbc2_0-stdext.jar:lib/jta.jar:lib/mysql-connector-java-5.1.5-bin.jar"/>
     </manifest>
</jar>

Now when I try to execute the package it executes, but whenever data is sent I get an error.

java.lang.NoClassDefFoundError: javax/persistence/NoResultException

But the persistence jar is there in the class-path, I’ve tried all the combinations for the class-path, but in vain.

But in another system I tried without create a jar like

set classpath=.;lib/activation.jar;lib/antlr-2.7.6.jar;lib/asm-attrs.jar;lib/asm.jar;lib/cglib-2.1.3.jar;lib/commons-collections-2.1.1.jar;lib/commons-logging-1.1.jar;lib/dom4j-1.6.1.jar;lib/ehcache-1.2.3.jar;lib/ejb3-persistence.jar;lib/hibernate-annotations.jar;lib/hibernate-commons-annotations.jar;lib/hibernate-entitymanager.jar;lib/hibernate-tools.jar;lib/hibernate3.jar;lib/javassist.jar;lib/jdbc2_0-stdext.jar;lib/jta.jar;lib/mysql-connector-java-5.1.5-bin.jar
java com.abc.xyz.HelloWorld

This works fine.

In Mac when I try like this:

java -cp .:lib/activation.jar:lib/antlr-2.7.6.jar:lib/asm-attrs.jar:lib/asm.jar:lib/cglib-2.1.3.jar:lib/commons-collections-2.1.1.jar:lib/commons-logging-1.1.jar:lib/dom4j-1.6.1.jar:lib/ehcache-1.2.3.jar:lib/ejb3-persistence.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/hibernate-tools.jar:lib/hibernate3.jar:lib/javassist.jar:lib/jdbc2_0-stdext.jar:lib/jta.jar:lib/mysql-connector-java-5.1.5-bin.jar com.abc.xyz.HelloWorld

Also it works fine :(, but the minute I create the jar it stops.

How can I resolve this issue?

  • 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-16T06:00:17+00:00Added an answer on May 16, 2026 at 6:00 am

    The reason for it not works was there not in the class path, the explanation is given here:
    Java-Jar-Ignores-Classpath-Workaround

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a Java program which I package and run from a JAR
I have written an Ant target that starts Selenium server, runs my test code,
I have an Ant script that performs a copy operation using the 'copy' task
I'm using Ant 1.8.2 with Java 6. I have written a custom task for
I have written a toolbar that runs on the taskbar. Unfortunately, after it is
I have written a class in python that implements __str__(self) but when I use
I have written a PHP application which requires storage of millions of integers between
I have written a program in VB6. When I compile it and send it
I have written a Python TCP/IP server for internal use, using win32serviceutil/py2exe to create
I have written a simple Java dispatcher with a daemon thread to handle the

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.