Compliation fixes for java examples

build scripts for scala and java examples are more similar
made minor changes in RandomWalk.java for successful compilation