Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+35 votes

I was wondering if anyone knew how to export the CSV file so that it will go to the computer of the user. Right now, the CSV file in our program exports to the project itself, so I was wondering if anyone knew a way so that it would export to the user's computer rather than just the project.

asked in CSC285_Fall2018 by (1 point)

1 Answer

+17 votes
 
Best answer

To be clear, the Eclipse project is stored somewhere on your computer, so you're exporting the CSV to their computer either way.

Perhaps what you are asking is -- how do I allow the user to choose where to save the exported CSV file ?

In which case, using a FileChooser to showSaveDialog is probably what you're looking for.

Examples here: https://www.programcreek.com/java-api-examples/?class=javafx.stage.FileChooser&method=showSaveDialog

Longer tutorial about FileChooser here: https://docs.oracle.com/javafx/2/ui_controls/file-chooser.htm

answered by (3.2k points)
selected by
...