Solved

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

Posted on 2004-10-01
4
198 Views
Last Modified: 2010-03-31
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
Comment
Question by:sivaprakasam
  • 3
4 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 12198599
> String fileName = "temppath,outfile.txt";

Try to get rid of the comma and try again.

0
 
LVL 35

Accepted Solution

by:
girionis earned 55 total points
ID: 12198601
> String fileName = "temppath,outfile.txt";

make it

String fileName = temppath + "outfile.txt";
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12198604
0
 
LVL 35

Expert Comment

by:girionis
ID: 12198732
:)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 80
github account with ecipse 1 47
Running JavaFX on JDeveloper 12C 1 31
going to wrong jsp page 2 20
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question