• 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem with saving the results to a file

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: 590
jQuery Java
  • 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
    Bookmark Topic Watch Topic
  • New Topic