I'll agree there - thought its not Java at fault necessarily - not unless you lump in a bunch of other languages like VB, C#, JS etc.
The problem is of the library code you're using. Libraries should be small, well defined, easy to use, and documented.
The problem today is (especially with code written in Java, .NET or JS) that it is knocked up to solve some problem but the problem is not only not properly understood, but the code that is provided doesn't solve it particularly well. Its not defined as a discrete task, more as part of some greater whole that someone thought "worked ok for me in my circumstances, so should be fine for others too".
If libs were properly specified as libraries and their API documented fully, then we would see more code reuse and better, cheaper code. If only, but the cost of making such a library tends to be too slow and difficult for the 'I want it now' majority, and this is why we continue to have this kind of shitty code problem.