Hi Dennis,
If you took a good look at that code it is the code from the exercise
I think your code is similar to this, but you forget some thing
It is the underlined statement
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);
}
}
This is called exception handlenig
You will face it in this lesson
http://www.javapassion.com/javaintro/index.html#Exceptions_and_Assertions
Hope I Helped,
A.S.El-Dalatony
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of dennis
njuguna
Sent: Thursday, January 29, 2009 1:59 PM
To: [email protected]
Subject: [java programming] SetSystemProperties
Hi guys
Im having a slight problem with this exercise, for setting system properties
((2.3) Set System properties) if I run the one in samples its working
but when i create my own the error
"unreported exception java.io.FileNotFoundException; must be caught or
declared to be thrown"
Seem not to disappear, what might be the problem.
Dennis
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---