I've been trying to put the data inside my ini file on a String after I write it, but somehow the output of the string is null. But when I check the ini file, it has value in it. I'm not sure if it's about the file path but I just copied the path in the directory. I hope someone can help me, newbie here. Thank you.
common.writeIniFileIdentify("PV-ID", PVIDNo); // PsFileAccessorIni.GetInstance().GetValueString(PsFileAccessorIni.PVIDLocation)); common.writeIniFileIdentify("PALMUS-ID", SerialNo);// PsFileAccessorIni.GetInstance().GetValueString(PsFileAccessorIni.PVIDLocation)); Properties p = new Properties(); p.load(new FileInputStream("C://PALMUS-PV/PVInfo.ini")); String pvid = p.getProperty("PVIDNo"); String palmusid = p.getProperty("SerialNo"); System.out.println(pvid); System.out.println(palmusid); Here's the writeIniFileIdentify:
public void writeIniFileIdentify(String key, String value) { try { Properties props = new Properties(); props.load(new FileInputStream(PVIDIdentifyLocation)); props.setProperty(key, value); props.store(new FileOutputStream(PVIDIdentifyLocation, false), null); } catch (Exception ex) { ex.printStackTrace(); } }
"C://PALMUS-PV/PVInfo.ini"should be"C:/PALMUS-PV/PVInfo.ini"