Convert many examples to java backend

**do not review yet**
I think it would be ideal to keep everything as much as possible as it was, because all the documentation was written for that old code.  So if that is not too much, I'd prefer to keep it things that way.  There are also latter definitions that use the nicer approach, so nothing is lost.  Thanks,