Search code examples
javajakarta-eejdbcpropertiesrunnable-jar

Merging properties file to existing Runabble jar not working


I have created a new properties file to access for DB connection, and I have exported for eclipse as a runnable jar. My code is able to detect the properties file and working fine. Where I need to merge this code to other Environment, I have taken the existing runnable jar from that environment and merged, my problem is here this merged code is not working. Below is my code.

Properties prop = new Properties();
            prop.load(State.class.getResourceAsStream("/data.properties"));

All I need is, even though if I merge the code it should work.


Solution

  • By changing the path, it started working. PFB

    
    Properties prop = new Properties();
                prop.load(State.class.getResourceAsStream("/resources/data.properties"));