Okay, I did javelin in high-school and I can tell you that even with a modern aluminum javelin (800 grams) a good thrower (not Olympic, just enough to qualify for state competitions) can only throw it 150 feet (50 meters). This is of course with little to no accurracy at all. In fact, half the time, the javelins don't even plant, they just kind of slide on the grass!
Of course, the ancient Mediterrean people did not have such good javelins, nor were they as strong or tall (height is a big factor is javelin throwing).
Now with a bow, the story is much different. With a measly 40 lbs bow (ancient bows were probably about that heavy I imagine) an unskilled archer can plant an arrow over 50 meters. He can do it with a decent amount of accuracy (left and right accuracy) too. What's more, unlike with a javelin where one needs a running start, the bow can be used at one's leisure.
So, why was the javelin ever in use when the bow was a much better alternative? I can understand it's use with legionnaires as it was their secondary weapon, but with velites?
I understand that the javelin was a heavier, deadlier projectile, but it is slow as all hell. Even aerodynamically perfect modern javelins cannot match an arrow's speed. And since it is such a big projectile, it is easy to see against the background of the sky. I cannot imagine that it would have been too difficult to dodge a javelin or to knock it out of the air with one's shield. I mean, think about it... how hard is it to catch a spiralled football (the American kind)? Most javelins travel at more or less the same speed as a football thrown with a spiral. And of course, a javelin is bigger. If a person can catch a javelin speed projectile then I can imagine they can knock it out of the air, or at least sidestep it.
Dodging arrows is next to impossible. blocking it with a shield is the only way. Not only is it much faster, but it is also a smaller projectile so it is harder to see against the sky.