How to point to jdni.properties file to set properties in Java

Posted by prosseek on Stack Overflow See other posts from Stack Overflow or by prosseek
Published on 2013-11-02T03:35:20Z Indexed on 2013/11/02 3:53 UTC
Read the original article Hit count: 243

Filed under:
|
|

I can use System.getProperties() method to set properties in Java.

System.getProperties().put("java.naming.factory.initial",
 "fr.dyade.aaa.jndi2.client.NamingContextFactory"); 
System.getProperties().put("java.naming.factory.host", "localhost");
System.getProperties().put("java.naming.factory.port", "16400");

How can I get the same effect by reading the properties stored in a file?

When I have a jdni.properties with the following content:

java.naming.factory.initial  fr.dyade.aaa.jndi2.client.NamingContextFactory
java.naming.factory.host localhost
java.naming.factory.port 16400

How can I teach Java to read them as properties?

© Stack Overflow or respective owner

Related posts about java

Related posts about properties