Want to avoid this ?
Use PAL library !
PAL labeling library is a ready-to-use C++ library providing efficient meta-heuristic algorithms for finding good placement solutions for point, line and polygon labeling. Java platform is also covered through JPAL JNI wrapper. It is released under the conditions of LGPL, GNU Lesser General Public License.
This website represents a platform with the main focus to federate and bring together an opensource community to maintain, offer support and follow innovative new developments in the field of labeling through PAL library.
Both the library and the community platform have been initiated by School of Business and Engineering Vaud, member of University Of Applied Sciences Western Switzerland (see more information about the initial project team).