Win a copy of Serverless Applications with Node.js this week in the NodeJS 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

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
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!