I've found the answer for it from this page http://docs.basex.org/wiki/Options
so for the java code in version 8.6.7, it needs to use
System.setProperty("org.basex.dbpath", "/home/xxx/test_basex/");
to set this global path and then, BaseX will read/create collection to this dbpath correctly.