I have a File named myfile
without extension. I want to add an extension to it so it will be myfile.ext
. I don't want to open it and save it with an extension. Just "rename" the File class instance.
How can I do it?
P.S. If that matters, I need this because I want to use this:
File myfiletopeon=myfile;
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().open(myfiletopeon);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null,"Problem","Problem",JOptionPane.ERROR_MESSAGE);
}
}
in order to open the file and I need an extension so that the file can be opened