Warning: I'd avoid this solution and go with Selenium in Docker.
DesiredCapabilities dcap = new DesiredCapabilities();
String[] phantomArgs = ["--webdriver-loglevel=NONE"]
dcap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs);
PhantomJSDriver phantomDriver = new PhantomJSDriver(dcap);
compile 'org.seleniumhq.selenium:selenium-java:2.28.0'
compile 'com.github.detro.ghostdriver:phantomjsdriver:1.1.0'