Jealousy and Envy (quick dictionary definition): painful desire of another's advantages.
This feeling comes in 2 forms:
Jealousy is about losing a value to someone else (the context for jealousy is always social). It is a painful feeling regarding a value one has and is afraid of losing - or something a person has difficulty having, but see another enjoying.
Example: Seeing the object of your romantic interest showing affection to someone else.
Envy is about something one does not have, does not believe he can have,and yet see another person having and enjoying.
Example: A chronically fat woman envying a good looking woman for being thinner. (You know the saying, "don't hate me 'cause I'm beautiful").
Jealousy, like other emotions, serves human survival. It is a negative emotion alerting a person in a painful way that his values are slipping away or that he is missing something crucial to him.
To illustrate: a child who feels unloved when his parents take away attention from him onto a new little brother, becomes jealous and upset. This shows in his behavior and alerts his parents that he needs more attention. Jealousy here serves to show that some value is in danger (in this case, it's the parent's affection).
While this is the normal function of jealousy (to protect life), it can arise as a result of some psychological problem or wrong standard of judging oneself.
By itself, jealousy is not related to self esteem. In other words the mere emotion of jealousy is not an indication of lack of self esteem. It depends what the subject of the jealousy is.
In some cases jealousy (or envy) is directed at another person's being, when the desired value in danger is one's own worth. Examples: Being jealous of someone because you consider them a better person morally, professionally, aesthetically, more popular, etc'.
To illustrate: suppose the person you're romantically interested in dates someone else - there are two types of jealousy possible here: One is being jealous for the woman - wanting the woman and being jealous that someone else has her. The other option is being jealous of the personality of the man who has her and seeing it as reproach for your personality not being good enough. The last type is much more severe and threatening.
The second type of jealousy in this example revolves around a self-doubt - a crack in one's self esteem.
In this case, a psychological problem (like a wrong premise) is involved and the actual threat indicated by jealousy is one's self-esteem.
How does this come to be? What makes some people satisfied with what they have, while others are jealous of someone's success?
It all starts with how a person learns to judge himself. Each person has some idea of his own worth in his eyes. Each person has a standard, or a set of ideas with which he judges himself.
Jealousy of the type associated to other people's success always involves an irrational standard for judging one's worth, and this can largely be based on how he was educated as a child - how his achievements and failures were treated by people the child looks up to for approval.
Consider the parents who make clear to their child, that to be loved and appreciated, he needs to get the best grades in the class, regardless of his actual ability. This places all the weight of his self worth on the actual concrete - the good grade - and not on his performance. If he did his best, and got an average grade - he is not worthy of a prize, but worthy of contempt or indifference. This kind of education makes self-esteem impossible. And worse, it places one's self esteem on a value that does not naturally arise from one's desires and interests. This child is taught that repression, self-beating and hard, joyless work are his main tools to become a worthy person. The feeling is of having something bigger than oneself, something from above, like a severe judge, that the person has to live up to to be worthy. "One day I will be happy, when I am thin". "One day, I'll be happy, when I am rich". And guess what? When they finally do get thin or rich, they are not happy. Because it has no personal value to them, it is a value gained only to "please the judge".
To give more examples of irrational standards: A standard for success is that one ought to succeed right away, purely from natural talent. Consider what it does to someone passionate about painting: He does not do as well as Michelangelo in his first attempt and then concludes he's no good and drops the whole thing. Or another example: Someone taking the action of productivity, divorced from his own desires and abilities, as part of his standard for judging people's worth (and his own worth). He immediately finds himself facing his own demand to start producing stuff in order to gain self-esteem. He becomes a slave to his own bad idea. A slave, because he makes himself work overtime without pay. "One day, when I am productive, I'll be happy".
A rational standard of judging oneself is based on evaluation of one's performance in relation to one's actual abilities. The last part is crucial. It sets the basis for rational self-esteem, which means, evaluation of one's worth rationally, by what is possible in reality, and not by a dream-goal which is unachievable to the individual.
[A side note: It is also important to choose the goals according to one's personal interests based on how a person feels about various things. A value should never be "something from above"].
From this it follows that a person should learn what are his abilities in those fields he wants to pursue (like sports, programming, painting, etc'). He does this by trying the best he can and observing the results and speed of progression in improving his skills in that field.
Once he has some idea what he can expect from himself, he judges himself by how well he did compared to his ability. This way, so long as the person does his best, he gains self esteem, even if others can do better than him.
In contrast, a person who judges himself only based on achievement of something or failing to achieve it, will always be on the lookout to see what others achieved. If they achieve better, he feels like they "steal" his self-esteem and feels hostility. This is because he places all the emphasis on the concrete. Admitting that he does not have what it takes to achieve that concrete is like death to his self-esteem. He must be all-powerful without limitations. So if someone else achieved it, but he did not, it shows that the concrete can be achieved, and therefore automatically it is a reminder of his personal failure, and a cause of jealousy. In fact, there may be no failure involved. It could be that this person did the best he could.
On the other side of the rope, telling a child that no matter what he does he is accepted and appreciated is bad too, since it encourages no effort from the child. The correct combination is judging one's success in achieving things but in relation to his abilities and limitations.
This creates an environment of self-acceptance and ambition combined (and I believe this is a rare combination nowadays).
This is a good place to remind that by itself, jealousy is not related to self esteem. The mere emotion of jealousy is not an indication of lack of self esteem.
It is only an irrational standard of judging one's worth that leads to the jealous type whose self-worth is threatened by other people's success. If one wishes to eliminate the jealousy - one needs to replace his incorrect standard.