Link to home
Start Free TrialLog in
Avatar of sivaprakasam
sivaprakasamFlag for United States of America

asked on

writing to file .....(java.io.tmpdir)

hi ...

i have a problem in writing the file to the temporary folder .....the file is not created ..if i give the path name by myself then the file is created .....
.
kindly anyone help me ....
Thanks in advance ....

MY CODING :

public void filewrite()
  {
 
        try {
           
                String temppath = new String(System.getProperty("java.io.tmpdir"));        
                String fileName = "temppath,outfile.txt";
                BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
           
            out.write("DB_CONNECTION =   ");        
            out.write(DBConnection.getText());
            out.write("; ");
            out.write(DBname.getText());
            out.write("; ");
            out.write(Username.getText());
            out.write("; ");
            out.write(password.getPassword());            
            out.close();

        } catch (IOException e) {

            System.out.println("IOException:"+e);
            e.printStackTrace();

        }
  }
Avatar of girionis
girionis
Flag of Greece image

> String fileName = "temppath,outfile.txt";

Try to get rid of the comma and try again.

ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial