There are various methods in attaching anubias or java ferns to wood, rock or decor.
Cotton thread or fishing line type of thing are fine to tie the base of the plant onto the wood. Just nedd to ensure you do not tie the thread too tight on the root.
Another method is superglue or strong glue which Nick mentions, just simply glue part of the root base onto the wood, NOT the roots, you only need a small amount simply to attach the plant to the wood. Do ensure the glue is free from anti mould chemicals and suchlike, look for 100% Cyanoacrylate glue, easily obtain from hardware stores or online, pretty cheap too.
The roots of the plants will eventually anchor themselves to the wood so you can then remove the thread/line if you wish to.
It's just a matter of preference on what method you like to use, some folks find tying thread / line pretty awkward to do and glue is much easier but the potential of making a mess and glueing your finger together is pretty high. heh.
I have used both methods above and tbh, pros and cons on both but once its done, no need to worry about it. Pretty much just 5 mins of cursing and fumbling to get things attached then you can forget about it, another pair of helping hands is a good idea btw.