• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!