Change the way we get the file and its absolute path to be compatible with older java version

GCP-10038

Reviewer: Chezka Arevalo