G
Gary Redmond
I am writing a program to store stuff to xml using the storeToXML method
but I can;t get it to compile here it is; any ideas?
import java.io.*;
import java.util.*;
public class XmlWrite {
public static void main(String args[]) throws Exception {
try {
Properties props = new Properties();
props.setProperty("something", "bla");
props.setProperty("stuff", "brown and black");
props.setProperty("morestuff", "me");
props.setProperty("enablepassword", "yes");
props.setProperty("answer", "null");
String OperatingSystem = System.getProperty("user.home") +"\\";
FileOutputStream xmlwrite =
new FileOutputStream(OperatingSystem + "config.xml");
props.java.util.Properties.storeToXML(xmlwrite, "config");
xmlwrite.close();
}
// if writing to the specified output stream results in an
IOException
catch (IOException e) {
//Print system error
System.err.println("An Error Occured While Writing To The
File");
}
// if os is null.
catch (NullPointerException e) {
//Print system error
System.err.println("OS Value is Null");
}
}
}
but I can;t get it to compile here it is; any ideas?
import java.io.*;
import java.util.*;
public class XmlWrite {
public static void main(String args[]) throws Exception {
try {
Properties props = new Properties();
props.setProperty("something", "bla");
props.setProperty("stuff", "brown and black");
props.setProperty("morestuff", "me");
props.setProperty("enablepassword", "yes");
props.setProperty("answer", "null");
String OperatingSystem = System.getProperty("user.home") +"\\";
FileOutputStream xmlwrite =
new FileOutputStream(OperatingSystem + "config.xml");
props.java.util.Properties.storeToXML(xmlwrite, "config");
xmlwrite.close();
}
// if writing to the specified output stream results in an
IOException
catch (IOException e) {
//Print system error
System.err.println("An Error Occured While Writing To The
File");
}
// if os is null.
catch (NullPointerException e) {
//Print system error
System.err.println("OS Value is Null");
}
}
}