Almost perfect script, errors with java text file and very large files