File f = new File("BatchFile.bat");
String path = f.getAbsolutePath();
works and returns full path of the file BUT the problem i am having is with string that is returned. it is returned in the form C:\folder\subfoler\filename but due to the path localization in java i cannot use
String[] cmds = {"cmd", "/k", path};
the string needs to be in the form C:\\folder\\subfolder\\filename and i have been trying to look for a way to modify the string into this format.
now if we use getAbsolutePath() and store it in a String called path
path = "C:\folder\subfolder\filename"
to be hoenst my problem wasnt with the File class but modifying the string f.getAbsolutePath() returned to use with the Runtimeclass, which you have explained in your final post.
No thanks. We have all the government we need. This tiny ad would like you to leave now:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|