SIOriginariamente inviato da fermat
dici una cosa del genere:
codice:public static synchronized void setProperty(String key, String value) { Properties properties = new Properties(); try { properties.load(new FileInputStream(fileProperties)); properties.setProperty(key, value); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Errore lettura file: " + fileProperties + "\nErrore: " + ex.getMessage()); } try { if (System.getProperty("os.name").contains("window")) { properties.store(new FileOutputStream(System.getProperty("user.home") + "\\config.properties"), null); } else { properties.store(new FileOutputStream(System.getProperty("user.home") + "/config.properties"), null); } } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Errore salvataggio file: " + fileProperties + "\nErrore: " + ex.getMessage()); } }

Rispondi quotando