import java.io.*; import java.util.Properties; public class IniReader { public Properties ini = null; public IniReader(String fileString) { File file=new File(fileString); try { ini = new Properties (); ini.load (new FileInputStream (file)); } catch (Exception ex) { ex.printStackTrace(); } } public String getIniKey (String key) { if(!ini.containsKey (key)) { return null; } return ini.get(key).toString(); } public static void main(String[] args) { IniReader ini=new IniReader("D:\\sendSMS\\conn.ini"); System.out.println(ini.getIniKey("driver")); } }