Re: Creating a file in a directory
- From: Mark Thomas <anon>
- Date: Sat, 31 Dec 2005 18:52:02 +0000
kevinhu19@xxxxxxxxx wrote:
I'm able to create a new file using
OutputStream savedFile = new FileOutputStream( newFile );
where newFile is a File object. However, how do I create this new file in a directory other than the current working directory? For example assume there is a directory in the current working directory 'test' and I want to create a file in 'test/blah.txt'
I tried something like this:
File newFile = new File( "test/blah.txt" );
add: newFile.createNewFile(); in here.
OutputStream savedFile = new FileOutputStream( newFile );
But Linux (FC2) keeps saying that "test/blah.txt" is a directory, not a file. Any clue?
-Kevin
Mark .
- References:
- Creating a file in a directory
- From: kevinhu19@xxxxxxxxx
- Creating a file in a directory
- Prev by Date: Re: Advantages of using private static methods in a class
- Next by Date: Re: Probs compiling - instanceOf statement and close brackets
- Previous by thread: Creating a file in a directory
- Next by thread: Probs compiling - instanceOf statement and close brackets
- Index(es):
Relevant Pages
|