how to get rid of bad character?

I often find myself struggling to feel sincerely happy for others' success, even though it is the success of people I like or love.

Anytime they tell me about their success, I told those that I think will understand (or already knew) something like 'I am happy for your success, but I feel a little jealous.'

Usually I sweeten that up to them with 'But my happiness is greater than my jealousy'.