• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

creating new files

 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know you can import an instance of a file by using...



but what if you wanted to create a file and then stick it in a
designated folder?

do you have to create a black .txt file and just ouput to it?

or can you actually "physically" create a new .txt file object within
a certain folder(which would have to be the folder the application currently resides).

just wanted to know...

Justin
 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Justin Fox:
I know you can import an instance of a file by using...



but what if you wanted to create a file and then stick it in a
designated folder?

do you have to create a black .txt file and just ouput to it?

or can you actually "physically" create a new .txt file object within
a certain folder(which would have to be the folder the application currently resides).

just wanted to know...

Justin



Well Justin,

I didn't understand your question properly, what I get by your statements is you want to create a file at a certain location and then move that file from it's original position to another position.

Is that so..

let us know the exact problem??
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably you meant "blank .txt file manually" instead of "black .txt file"

You can create new files as follows:

File file = new File(fileName);
file.createNewFile();

So if the filename "blank.txt" then the code snippet above creates an empty file named "blank.txt" in the current folder. (normally application folder)

And if you want to make sure that its directories exist before saving the file:

File dir = new File(dirName);
dir.mkdirs();
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you, thats what i needed to know...

but now i have a perdy dumb question...

i have folders on my desktop, and i want to change the color,
is there a way to do this without having to download a
folder modifying program?

thanks,
Justin
 
reply
    Bookmark Topic Watch Topic
  • New Topic