Fix for deep symbolic links on linux

There are sometimes more than one level of symobolic links on the java file.
I've added a recursive symbolic link function (which tests as it goes) to find the origin directory.