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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:07:11+00:00 2026-06-01T10:07:11+00:00

I got a TestNG test, that works perfectly fine on it’s own. Somewhere in

  • 0

I got a TestNG test, that works perfectly fine on it’s own. Somewhere in it I got:

URL fileName = this.getClass().getClassLoader().getResource("config.properties");

I’m trying to run the same test using Ant:

<testng outputDir="${resultsFolder}" haltOnFailure="false">
  <classpath>
      <fileset dir="./src/">
        <include name="**/*.properties"/>
      </fileset>
            -----------------------------...--------------------
 </classpath>
 <classfileset dir="correct path here" includes="**/*.class" />
</testng>

I can see in debug mode that the config.properties is in the classpath. But the line at the top can not find it, it is null.

EDIT: I solved it.The critical line actually does not search for the file in the classpath directly, it searches IN the files/folders. So, this solved my problem:

<pathelement location="src/"/>

Thanks for the help.

  • 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-06-01T10:07:12+00:00Added an answer on June 1, 2026 at 10:07 am

    try to replace your <classpath>...</classpath> with this:

    <classpath>
         <pathelement path="./src"/>
    </classpath>
    

    In order for JVM to find the config.properties the parent directory of config.properties should be in classpath.

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

Sidebar

Related Questions

So here's an issue at my work. I've got a few TestNG cases that,
I've got a method that I'd like to test with JUnit/Mockito. The method takes
I'm testing a module that does webscraping. I've got this method that grabs the
I've got a functional test that's using fixtures. I also am using fixtures in
Im writing to a file using WriteFile . That works fine. Its just a
In a program that I'm testing with Coded UI Tests, I've got a window
Got this error message while trying to load view: The model item passed into
I have a very simple test page that uses XHR requests with jQuery's $.getJSON
I try to setup a project with spring-test using TestNg in Maven. The code
So I got a site that uses ISO-8859-1 encoding and I can't change that.

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.