creating a file with a particular extention

Hello All, I wanted to know how I can create a file with a particular extension using Java. Any kind of explanation would be great.Thanks,
[152 byte] By [gradnasha] at [2007-11-27 6:04:48]
# 1
Use a java.io.FileWriter or java.io.FileOutputStream, optionally also using a java.io.File, and when you specify the filename, give it the extension you want.
paulcwa at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 2
> Use a java.io.FileWriter or java.io.FileOutputStream,> optionally also using a java.io.File, and when you> specify the filename, give it the extension you want.Thanks for the reply. Please can you let me know with an example.Thanks
gradnasha at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 3
There may be examples in the API docs. If not it's pretty simple to figure out.Besides, using a particular filename extension is so trivial that I suspect that it's not the real problem, and any example without more info from you would be inapplicable.
paulcwa at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 4

> There may be examples in the API docs. If not it's

> pretty simple to figure out.Besides, using a

> particular filename extension is so trivial that I

> suspect that it's not the real problem, and any

> example without more info from you would be

> inapplicable.

Thanks for the reply. I am looking at how to create a file with a particular extension. It will be great if you can give me an example. I went through the java.io.FileWriter, java.io.FileOutputStream and java.io.File, but I was not able to get any kind of example.

Please let me know

Thanks

gradnasha at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 5

> > There may be examples in the API docs. If not

> it's

> > pretty simple to figure out.Besides, using a

> > particular filename extension is so trivial that I

> > suspect that it's not the real problem, and any

> > example without more info from you would be

> > inapplicable.

>

> Thanks for the reply. I am looking at how to create a

> file with a particular extension. It will be great if

> you can give me an example. I went through the

> java.io.FileWriter, java.io.FileOutputStream and

> java.io.File, but I was not able to get any kind of

> example. >

How is this possible?

cotton.ma at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 6
This attempts to create a new, empty file with the extension "pingu":boolean success = new File("penguin.pingu").createNewFile();
Hippolytea at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 7

OK, fine, lazy-boy.

try {

FileWriter f = new FileWriter("file.yourextensionhere");

f.close();

} catch (IOException e) {

e.printStackTrace();

}

paulcwa at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 8
Hippolyte's is better, for the task of creating an empty file.
paulcwa at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 9
> Hippolyte's is better, for the task of creating an empty file.Yeah, but can anybody understand what those penguins are saying?[url #" style="display: block; background-image: url(' http://www.petermoore.net/blog/06_06/pingu.jpg'); width: 209px; height: 250px] [/url]
Hippolytea at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 10
> Yeah, but can anybody understand what those> penguins are saying?That's odd. They're commanding me to kill.
paulcwa at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 11

> > Yeah, but can anybody understand what those

> > penguins are saying?

>

> That's odd. They're commanding me to kill.

Noooo!!! Don't do it:

[url #" style="display: block; background-image: url('http://nyilvan.freeblog.hu/Files/pingu-pinga-wallpaper.jpg'); width: 1024px; height: 768px] [/url]

Hippolytea at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 12

> OK, fine, lazy-boy.

>

> try {

> FileWriter f = new

> FileWriter("file.yourextensionhere");

> f.close();

> catch (IOException e) {

> e.printStackTrace();

>

Thanks for the reply. I am kind of new to this.

gradnasha at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...
# 13

> > OK, fine, lazy-boy.

> >

> > try {

> > FileWriter f = new

> > FileWriter("file.yourextensionhere");

> > f.close();

> > catch (IOException e) {

> > e.printStackTrace();

> >

>

> Thanks for the reply. I am kind of new to this.

Then learn real quick how to do your own research.

floundera at 2007-7-12 16:49:29 > top of Java-index,Java Essentials,Java Programming...