• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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();

        }
  }
0
sivaprakasam
Asked:
sivaprakasam
  • 3
1 Solution
 
girionisCommented:
> String fileName = "temppath,outfile.txt";

Try to get rid of the comma and try again.

0
 
girionisCommented:
> String fileName = "temppath,outfile.txt";

make it

String fileName = temppath + "outfile.txt";
0
 
girionisCommented:
:)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now