Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Able to save File but unable to write to file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Able to save File but unable to write to file" Watch "Able to save File but unable to write to file" New topic
Author

Able to save File but unable to write to file

Kim wee
Greenhorn

Joined: Nov 25, 2011
Posts: 5
Hi

Im having this weird problem where im able to save a new file but im unable to write into the saved file.

care to explain where and what went wrong with my code?

Thanks in advance!
cheers!

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18115
    
    8

How do you know you are unable to write to the file?
Kim wee
Greenhorn

Joined: Nov 25, 2011
Posts: 5
because the file size is 1KB everytime i save the files and when i open the file its empty.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Kim wee wrote:because the file size is 1KB everytime i save the files and when i open the file its empty.

1 kb is not an empty file... try opening it in a text editor. Writing an object information will take that much size only I think.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
What is the "file" object that you're writing to the file?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

And how do you open the file? The file will contain binary contents, not text. That means that a text editor will most likely not be very good at displaying the file. A HEX editor is a better choice.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Able to save File but unable to write to file
 
Similar Threads
Program mod w/o command line arguments
Could you unzip a file with a java program
sort different file length records
Unknown Source
Setting file name for JFileChooser SAVE dialog