Results 1 to 3 of 3
- 11-04-2010, 12:27 AM #1
Member
- Join Date
- Apr 2010
- Posts
- 22
- Rep Power
- 0
java i/o question: where is stuff.txt???
hello
i am learning java on eclipse.
if i am correct this program should output :
"writing to output
end of program"
in eclipse and
return "the quick brown bla bla" output in stuff.txt...i cant find stuff.txt in eclipse???????
Java Code:package worksheet; import java.io.*; public class ABC { public static void main(String[] args) { PrintWriter outputStream = null; try { outputStream = new PrintWriter(new FileOutputStream("stuff.txt")); } catch(FileNotFoundException e) { System.out.println("Error opening the file stuff.txt"); System.exit(0); } System.out.println("Writing to file"); outputStream.println("The quick brown fox"); outputStream.println("jumped pver the lazy dog"); outputStream.close(); System.out.println("End of program"); } }
- 11-04-2010, 01:16 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
new PrintWriter(new FileOutputStream("stuff.txt")
Try doing this as a multi step process:
* First create a new File("stuff.txt")
* Then create the PrintWriter from that.
That way you can use the appropriate File method to print the full path and name of the file you are using.
- 11-04-2010, 05:04 AM #3
Member
- Join Date
- Nov 2010
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
where the stuff goes?
By Izabela in forum New To JavaReplies: 16Last Post: 08-31-2010, 02:00 PM -
JDK, SDK, JDT, JRE, what is all stuff? why do i need it?
By sonny in forum New To JavaReplies: 6Last Post: 05-26-2010, 12:17 AM -
I'm new to JAVA, stuck on "int"...Need some help getting this stuff straight, thanks!
By moe123 in forum New To JavaReplies: 5Last Post: 09-16-2009, 01:36 PM -
Looking for help on drawing stuff in a jPanel
By Gatts79 in forum AWT / SwingReplies: 3Last Post: 08-28-2009, 06:00 PM -
Simple Stuff 0.1
By Java Tip in forum Java SoftwareReplies: 0Last Post: 07-19-2008, 04:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks