Java JFileChooser getAbsoluteFile Add File Extension

Posted by ikurtz on Stack Overflow See other posts from Stack Overflow or by ikurtz
Published on 2010-04-28T14:15:40Z Indexed on 2010/04/28 14:33 UTC
Read the original article Hit count: 318

i have this issue working but i would like to know if there is a better way of adding the file extension?

what i am doing right now is:

String filePath = chooser.getSelectedFile().getAbsoluteFile() + ".html";

im adding the extension hard coded. and then saving to it.

just wondering if there is a more robust/logical manner this can be implemented?

thank you for your time.

EDIT: i ask this as i would like my app to be portable across platforms. so adding .html manually i may make this a windows only solution.

© Stack Overflow or respective owner

Related posts about jfilechooser

Related posts about getabsolutefile