I have a program where I save school grades in a .txt File. I want to let the user choose where this File should be saved. It works with the JFileChooser find but Java have a problem with the FilePath. The filepath from the JFileChooser looks like this: C:\Users...\Documents\n.txt But if I want to read the TextFile in the Program Java says that it couldn't find the Filepath. It should look like this: C:\Users\...\Documents\n.txt
How can I get the Path with double-backslashes?
public void actionPerformed(ActionEvent e) {
JFileChooser jf = new JFileChooser();
jf.showSaveDialog(null);
String fPath = jf.getSelectedFile().getPath();
fPath.replaceAll('\', '\\');
System.out.println(p);
}
that does not work it says invalid character constant