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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:01:54+00:00 2026-06-15T17:01:54+00:00

I have a class that loads its properties file using class.getResourceAsStream(props.properties). The properties file

  • 0

I have a class that loads its properties file using class.getResourceAsStream(props.properties). The properties file is in the same package as the class itself, yet it is now returning null rather than the object. I am frazzled because this works fine on an original computer, yet fails on a different computer. I copied the entire directory structure over from the old to the to new. I’m using Netbeans 7.2.1 on both computers. I’m sure its got to be a classpath setting or SOMETHING but I cant find any differences between the two environments whatsoever. Here’s sample code:

package Cab;
import java.util.*;
import java.lang.reflect.*;
import java.io.*;

public class CabTest{

    public static void main(String[] args)
    {
        Properties  l_Prop = new Properties();
        InputStream l_IS;
        try
        {
           l_IS = CabTest.class.getResourceAsStream("props.properties");
           l_Prop.load(l_IS);
        }
        catch(IOException l_Exc)
        {
            System.out.println(l_Exc);
        }
    }
}
  • 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-15T17:01:54+00:00Added an answer on June 15, 2026 at 5:01 pm

    This says that if the .class file is in package “foo.bar.baz.props.properties”, then that’s the path you ought to give to the classloader:

    l_IS = this.getClass().getResourceAsStream("foo/bar/baz/props.properties");
    

    Your way will work only if it’s at the root of the CLASSPATH.

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

Sidebar

Related Questions

I have an AS 3.0 class that loads a JSON file in using a
I have a class that upon construction, loads it's info from a database. The
in AS3, I have an external class ImageLoader, that loads an image upon request.
i have an application that loads the page content. I use the WebClient class.
I have a data access class that loads reference data. Each type of entity
I have an MVC3 project that is using an EF4 project as its Domain.
I have a class that I instantiate to save or load xml data. For
I have this class that have a function to load other classes and create
I have a class - XClass, that I want to load into an array
I'm trying to load text of all divs that have a particular class into

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.