This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

problem with saving the results to a file  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The purpose of this code is to let the user choose a txt file through JFileChooser which looks like this (https://ibb.co/jYHdfk)
then for each line of the text file take the first line and create a new txt file with the first element as a name of that file and inside this file but the rest of the line
it will be like this (https://ibb.co/csLg0k)
I let user choose the file then send the file path to a method called Split() and this method will do the work
but i dont know how to save the results of that method to the save in file that has been specified by the user
I want to let the user choose the file then call the split method to do the work then make the user  choose a location to save the results in
so i did that using JFileChooser showSaveDialog but i cant link them together the results are shown on the default location

sorry for typing so much but i really want to make everything clear
this is the whole code, hope you can help me
 
Ranch Hand
Posts: 579
6
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a file output stream. If you have the file and the content you would like to write in it, you can use file output stream. Check this javadoc: FileOutputStream
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!