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 7584173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:51:24+00:00 2026-05-30T18:51:24+00:00

My code is being deployed as a JAR file. The JAR contains a directory

  • 0

My code is being deployed as a JAR file. The JAR contains a directory lib which contains a number of third-party JARs which my code requires. I’ve added these to the classpath, using Ant, via the MANIFEST.MF.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 20.5-b03 (Sun Microsystems Inc.)
Main-Class: com.package.Class
Class-Path: ../lib/c3p0-0.9.1.2.jar ../lib/dbunit-2.4.8.jar ../lib/gua
va-10.0.1.jar ../lib/hsqldb.jar ../lib/javax.jms.jar ../lib/log4j-1.2
 .16.jar ../lib/mockito-all-1.9.0.jar ../lib/ojdbc14.jar ../lib/slf4j-
 api-1.6.4.jar ../lib/slf4j-log4j12-1.6.4.jar ../lib/xmlunit-1.3.jar

There is also a queries.properties file which is in the root of the JAR.

There are two further properties files which are required. I would like these to reside in the same directory as the JAR file and for the code to be able to locate them. I believe for the code to be able to locate these properties files, they need to be in the classpath. I therefore need to add the JAR file’s directory to the classpath.

Firstly, is this the correct approach of should I use an alternative means of locating the properties files?

If this is correct, how do I use Ant to add the JAR’s current directory to the classpath in MANIFEST.MF? I added the JARs in the lib directory to the classpath using the manifestclasspath Ant task.

  • 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-30T18:51:25+00:00Added an answer on May 30, 2026 at 6:51 pm

    Have you tried adding the . as a reference to the current directory?

       <jar jarfile="dummy.jar">
                <manifest>
                        <attribute name="Main-Class" value="com.package.Class"/>
                        <attribute name="Class-Path" value=". ${jar.class.path}"/>
                </manifest>               
        </jar>
    

    Please also see Executable jar won't find the properties files

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

Sidebar

Related Questions

I have an ASP.NET web service which will create a text file in a
I have a Web Application deployed to a local Glassfish server which I would
I'm trying to create a tar file for deployment of some code but I
I have a need to integrate a third-party Java applet into a custom web
I've got a project setup with Maven, being built in Hudson and artifacts deployed
I have a WAR file that I have deployed to Tomcat 7.0.23 via the
I have these two lines in my code being developed in HTML5: context.rotate(radian); radian
I was recently amazed to see Java code being automatically recompiled and injected into
So I have this old code being used, that runs simple ExecuteNonQuery command for
I have Common.dll that's shared/used by (far more than) two SharePoint packages being deployed

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.