Reputation: 345
I have two Java Projects, and I am trying to read the properties file in one from another. I have added "Infrastructure" Project in Build path of "Java" Project, and the properties file is at root folder, but I am getting java.io.FileNotFoundException
I tried bunch ways, but couldn't make it work. Which part is causing the problem?
public static void main(String[] args) throws Exception {
Properties properties = new Properties();
properties.load(new FileInputStream("application.properties"));
}
Here is the Project Explorer;
Upvotes: 0
Views: 2522
Reputation: 5597
Use: properties.load(YourClass.class.getResourceAsStream("/application.properties"))
instead.
Upvotes: 2