See the API for JFileChooser - getName is a method for Component, which must be set with setName. I presume you want the file name, or absolute path, in which case you should be calling...