My application will check if a Properties file exists and create one if not.
try{
        // create new file
        String path="c:\\temp\\LaserController.properties";
        File file = new File(path);
        String comport = "Comport=COM1";
        String Parity = "parity=none";
        String baud = "baud=9600";
        String Stopbits = "StopBits=0";
        String databits = "DataBits=8";
           // if file doesnt exists, then create it
           if (!file.exists()) {
               file.createNewFile();
           FileWriter fw = new FileWriter(file.getAbsoluteFile());
           BufferedWriter bw = new BufferedWriter(fw);
           // write in file
           bw.write(comport);
           bw.newLine();
           bw.write(Parity);
           bw.newLine();
           bw.write(baud);
           bw.newLine();
           bw.write(Stopbits);
           bw.newLine();
           bw.write(databits);
           // close connection
           bw.close();
           }
But when i try to read the properties file like this i get a Null pointer.
else {
           Properties prop = new Properties();
            InputStream input = LaserControllerUI.class.getResourceAsStream("c:\\temp\\LaserController.properties");
            // load a properties file
            prop.load(input);
            // get the property value and print it out
            System.out.println(prop.getProperty(Comport+"comport"));
            System.out.println(prop.getProperty("Parity"));
            System.out.println(prop.getProperty("Baud"));
            input.close();
        }
     }catch(Exception e){
         System.out.println(e);
     }
}       
It fails on the InputStream input line but i dont know why. the file exists and my application can access it because it put it there in the first place. What am i doing wrong?
The file has to be in a location that is accessible to users to change parameters.

 
     
     
     
    