Creating a file in a directory
- From: "kevinhu19@xxxxxxxxx" <kevinhu19@xxxxxxxxx>
- Date: 30 Dec 2005 13:13:01 -0800
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" );
OutputStream savedFile = new FileOutputStream( newFile );
But Linux (FC2) keeps saying that "test/blah.txt" is a directory, not a
file. Any clue?
-Kevin
.
- Follow-Ups:
- Re: Creating a file in a directory
- From: Mark Thomas
- Re: Creating a file in a directory
- Prev by Date: Re: Yahoo Games
- Next by Date: Probs compiling - instanceOf statement and close brackets
- Previous by thread: How can check a window service is running or not in java
- Next by thread: Re: Creating a file in a directory
- Index(es):
Relevant Pages
|