I have the variable directory
which will be a directory that the user inputs,
such as
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe". The issue is that the program doesn't recognize the directory, and thus won't launch it via Runtime.getRuntime().exec(new String[] {directory});
How would I make a method/algorithm that takes every \
from directory
and turns it into a \\
?
if (directory.substring(j, j+1).equals("\\"))
{
//directory.substring(j, j+1) == "\\\\";
}
Ex:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
should turn into
C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe