Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within I/O and Streams
Search Coderanch
Advance search
Google search
Register / Login
Last week, we had the author of
TDD for a Shopping Website LiveProject
. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See
for the agenda and registration link
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
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
I/O and Streams
Saving to a text file!
Sun Sen
Greenhorn
Posts: 6
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How can I save data from my
Java
Application to a text file as opposed to saving to Database?
Dirk Schreckmann
Sheriff
Posts: 7023
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
One example:
import java.io.FileWriter; import java.io.PrintWriter; import java.io.IOException; public class Foo { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(new FileWriter("myFile.txt")); out.println("my output"); out.flush(); out.close(); } }
Moving this to the I/O and Streams forum...
[
How To Ask Good Questions
] [
JavaRanch FAQ Wiki
] [
JavaRanch Radio
]
Sun Sen
Greenhorn
Posts: 6
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Would your example work with write to file under
JSP
's as well?
Al Kaiser
Ranch Hand
Posts: 35
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How does this code work with JSP?
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Please include me in your group
writing arabic text in a file....
Using javascript in java
what is the difference between saving file as M.java and "M.java" ???
A question regarding saving jpgs into text files.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
More...