import java.io.FileInputStream;
import java.util.Properties;
/**
*
* @author jason.ewton
*/
public class SetSystemProperties {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//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 set property method
p.setProperty("myKey1", "myValue1");
//set the system properties
System.setProperties(p);
//display new properties
System.getProperties().list(System.out);
}
}
I added an empty file called myProperties.txt to the project. It just shows
up as unrecognized file. The compiler won't compile because it has a
filenotfound exception. What am I doing wrong here?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---