?
Solved

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

Posted on 2004-10-01
4
Medium Priority
?
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 165 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 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