Tips&Tricks | I trucchi del mestiere |
![]() |
Come effettuare il merging delle proprietα |
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); |
java -Djdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver MiaClasse |
private static void mergeProperties(String propFile) { Properties p = new Properties(System.getProperties()); try { p.load(MiaClasse.class.getResourceAsStream(propFile)); System.setProperties(p); } catch (IOException e) { e.printStackTrace(); } } |
public static void main(String[] argv) { MiaClasse.mergeProperties("NomeDelFileDiProprieta.properties"); ... } |
![]() |
Un po' di Reflection all'opera. |