简体   繁体   中英

how to refer a properties file in Java project

I have a Node.properties file placed in the config folder of my Java project. The hierarchy of the folder is :

**Project**
   ->src
   ->config
      ->client
      ->eclipse
          ->test
      ->preferences

When I build the code successfully and try to run a test class using JUNIT, I get an error -

Node.properties not found in classpath

I have checked the classpath file and found that while the path /config/eclipse/test is referred, the files in /config/client are not being referred.

Could you please let me know how can I ensure that the file is found in classpath?

I am using Ant script to build the project in Eclipse.

Thanks!

If you are running eclipse

  1. Rt click on the project -> select properties
  2. Click Java Build Path
  3. Under Source tab Add the path config/client

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM