Fixed Java tests build

Java tests where not built on buildbot because of java->xfeatures2d->cuda dependency. PRs #3191 and Itseez/opencv_contrib#81 removed this dependency, and some precommit builders have failed because of broken tests.
This PR also fixes java disabling after second cmake run in same build folder, because of empty `PYTHON2LIBS_FOUND` variable.