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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:52:41+00:00 2026-05-23T16:52:41+00:00

I wanted to have a certain JAR in my classpath for easy access with

  • 0

I wanted to have a certain JAR in my classpath for easy access with a Jython REPL. So in my .bashrc I put:

export CLASSPATH=:/home/tmacdonald/path/to/jar/thing.jar

However, this breaks ant both for compiling that JAR can compiling a JAR from a different subpackage:

$ ant jar
Invalid implementation version between Ant core and Ant optional tasks.
 core    : 1.8.0 in file:/usr/share/ant/lib/ant.jar
 optional: 1.5.1 in file:/home/tmacdonald/path/to/jar/lib/gt2-2.3.3/ant-optional-1.5.1.jar
$ echo $CLASSPATH
:/home/tmacdonald/path/to/jar/thing.jar

Changing the classpath fixes it:

$ export CLASSPATH=
$ !ec
echo $CLASSPATH

$ ant jar
[Compiles successfully.]

But it seems awkward and not The Right Thing to have to keep changing my classpath, depending on whether I wanted to run ant or a Jython REPL. I’ll admit that my knowledge of both ant and the classpath is pretty weak. I just think of the classpath as being, “PATH for Java libraries; or PYTHONPATH for Java”, and I only ever add small changes to existing ant config files I inherited–I’ve never had to set one up.

So I’d be interested to hear what’s really happening (and incidentally how that causes my problem) so I can be a little bit more educated, and of course I’d also like a fix. Thanks!

  • 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-23T16:52:41+00:00Added an answer on May 23, 2026 at 4:52 pm

    I don’t think Ant should know or care about environment variables. The right way to do it is to set CLASSPATH inside the Ant build.xml itself.

    Here are production and test classpaths that I use in my Ant build.xml files:

    <path id="production.class.path">
        <pathelement location="${production.classes}"/>
        <pathelement location="${production.resources}"/>
        <fileset dir="${production.lib}">
            <include name="**/*.jar"/>
        </fileset>
    </path>
    
    <path id="test.class.path">                            
        <path refid="production.class.path"/>
        <pathelement location="${test.classes}"/>
        <pathelement location="${test.resources}"/>
        <fileset dir="${test.lib}">
            <include name="**/*.jar"/>
        </fileset>
    </path>
    

    As you can see, there are no references to ${classpath}, nor should there be.

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

Sidebar

Related Questions

I have several plt.plot instances and I wanted to only plt.show() certain objects. To
i'm wanted to perform some ajax calls in a certain way. I have a
I have a certain code written in Matlab. I wanted to obtain similar results
I have wanted to try GAE since launch, but coming from ASP .NET and
Say I wanted to have a project, and one-to-many with to-do items, and wanted
If I wanted to have Python distributed across multiple processors on multiple computers, what
Say I wanted to have one variable in a class always be in some
If I wanted to have a collection that described the (recursive) contents of a
Let's say I wanted to have an application that could easily switch the DB
I am programming in Ruby and have wanted to learn about matrices but I

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.