What's  the point of setting the initial properties to those in
"myProperties.txt"?  And is it required in the Homework assignment?  

 

import java.io.FileInputStream;
import java.util.Properties;

public class SetSystemProperties {
    
    public static void main(String[] args) throws Exception {
        
        // set up new properties object
        // from file "myProperties.txt"
        FileInputStream propFile = new FileInputStream(
                "myProperties.txt");
        Properties p = new Properties(System.getProperties());
        p.load(propFile);
        
        // set a property through setProperty() method
        p.setProperty("myKey1", "myValue1");
        
        // set the system properties
        System.setProperties(p);
        
        // display new properties
        System.getProperties().list(System.out);
    }
    
}


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to