Instead of using ~ go to the real path (i.e. /home/<your username>/... ), it should work as expected.
To clarify, this is not a Java-specific issue, try this in your shell:
$ echo ~/.bashrc:~/.bashrc
You should get something like:
/home/icyrock.com/.bashrc:~/.bashrc
(where icyrock.com is of course replaced by your username). The second ~ does not extend to bash, so there are problems. You expect it to expand to:
/home/icyrock.com/.bashrc:/home/icyrock.com/.bashrc
That is why you have the "first job, but the second not."
Looking at the bash manual:
you can see this:
If a word begins with an unquoted tilde ('~), all characters up to the first invalid slash (or all characters if there is no invalid slash) are considered the -prefix tilde.
(my selection), so only the first tilde expands, since the second tilde is not at the beginning of the word.
source share