Let's say I want to pass the following paths on the command line:
Path a: C:\example a\test
Path b: C:\example b\test\
java -jar myjar.jar C:\example a\test C:\example b\test\
Java splits arguments using whitespace, so we would end up with an args array like this:
arr[0] = C:\example
arr[1] = a\test
arr[2] = C:\example
arr[3] = b\test\
But if we also want to accept non-absolute paths, so supplying "\test" will cause the program to accept that as <parent directory>\test.
This gives a lot of problems and is much more complicated than it first appears. How do we tell Java that "a\test" is actually a part of "C:\example a\test" rather than "<parent directory>\a\test"?