Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Finding files  RSS feed

 
Martin Vietor
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

as usual I am sure you will be able to help my unsolvable problem in one line

I would likt to load some csv-file data. There are several files, I would like the user to be able to choose one. Is there a way to read which files are in a folder without knowing the names? Basically like any Windows application. Click "Open", get a list of files, choose one, it gets loaded.

Thanks, M
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out which methods java.io.File has for listing (hint, hint) the contents of a folder.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what java.awt.FileDialog and javax.swing.JFileChooser do. If you want to roll your own, then new File("dir").listFiles() would come in handy.
 
Martin Vietor
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a bunch, both are exactly the answers I was looking for
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!