aspose file tools*
The moose likes I/O and Streams and the fly likes open text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "open text file" Watch "open text file" New topic
Author

open text file

Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

IN my java program I write data to a new text file. When I finish, how would I open the text file from the program so that the user sees it.


Jesus lives
Jaime M. Tovar
Ranch Hand

Joined: Mar 28, 2005
Posts: 133
You can use FileReader wrapped by a BufferedReader. Then you can readLine while not null.


She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.
Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

Sorry , I ment open the actual text file like notepad, not read the text by java
John Calabasas
Greenhorn

Joined: Jun 11, 2006
Posts: 17
May be you can try double clicking the file if the extension is registered for a text file reader?

If you want to do it in single step, you can write a script to run the java progam and then invoke your text reader.



You can also invoke external programs from within the code using Runtime.exec()
[ July 04, 2006: Message edited by: John Calabasas ]

I hate quotations. Tell me what you know.
Jaime M. Tovar
Ranch Hand

Joined: Mar 28, 2005
Posts: 133
Yours is a swing app? If it is, there is a swing component to display text, like a textarea.

If it is a command line app maybe the best option is to open the file will a runtime calling for notepad and passing the file name as a parameter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: open text file
 
Similar Threads
how to open db.db file
what program can be used to execute .bin file
how to open a .chm file
Remember last file opened
FTP problem