[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2004-10-01
4
Medium Priority
?
204 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

649 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