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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:19:48+00:00 2026-05-30T21:19:48+00:00

I am developing a Java Application (not a web app, no server etc) using

  • 0

I am developing a Java Application (not a web app, no server etc) using Netbeans 7.0.1 IDE.
Right now I have an issue with reading any properties /or any other file from my java class.

Here is what I am doing

 FileReader f = new FileReader( new File(args[0]) );
 BufferedReader r = new BufferedReader(f);

in the argument I pass the file name like connector.properties (I have the file in the same package as this class). the project when run gives the error below

Can't load: connector.properties : Exception is: connector.properties (The system cannot find the path specified)

why am I not able to read the properties file? whats the root of my classpath?

when I set the 'Working Folder' (right clicking the project and selecting ‘Run’ section) to the package level like C/complete/path/to/the/package
only then the properties file is read.
I want to know why do I need to set the working folder in Netbeans project and how can I read the file without setting the working folder?

  • 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-30T21:19:50+00:00Added an answer on May 30, 2026 at 9:19 pm

    This is because you are not using a class path reader to read your properties file. Your above code reads a hard path.

    And, to read a properties file from a class path, you can use apache commons Configuration’s file properties reader. There are several options there for reading properties file and the stream these input files are coming from e.g. Classpath.

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

Sidebar

Related Questions

I'm developing a web application using JSF 2.0, NetBeans 6.9.1, GlassFish Server 3.1, mojarra
We're developing a data heavy modular web application stack with java but have little
I am developing a dynamic web project j2ee web application using eclipse. I have
I'm writing a client and server application. Right now I've just been developing it
We are developing web based java application. Richfaces used as library.And we have datatable
I am using struts2 for developing a web application. I have include the required
I have been developing my web-app using JPA 2.0 implementation EclipseLink 2.2.0. I finally
I have a Java web application I’m developing for a school project. There’s a
I'm developing a Java webapp using Spring, Spring Security, Tomcat and MySQL. Right now
I'm developing a Java application using Eclipse. My project has two source directories 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.