refactored checking if run from java8