File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

open text file

 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use FileReader wrapped by a BufferedReader. Then you can readLine while not null.
 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry , I ment open the actual text file like notepad, not read the text by java
 
John Calabasas
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic