INI JAVA

well what im trying is that a java application should read a INI file(initialization file) while it starts , how can i specify a java program to read a INI file when it starts.any help is welcome with utmost gratitude
[231 byte] By [siv-viv] at [2007-9-26 1:17:04]
# 1
Why don't you use java.util.Properties.It's almost like a ini file and there are methods to load and save Propertins from and to file.
v.pavlov at 2007-6-29 0:45:56 > top of Java-index,Archived Forums,Java Programming...
# 2

The real problem is how to get Java to find the right file since it can be run from other directories. There are two option to get it to read at the program start.

1) Use a static block which calls the read

2) (better) Load it when the first piece of information from it is requested. The method to get information first checks if the ini file is loaded, loads it if it isn't and then returns the value. If this is done somewhere static, then it will only load once, and you can be sure that it will not load until the program starts.

smh3r at 2007-6-29 0:45:56 > top of Java-index,Archived Forums,Java Programming...