Javelins were effectively replaced by the crossbow in the west due to the crossbow's far superior range and the simplicity of its use. However, the Almughavares of Spain were famous for their use of the javelin, and these developed out of long Middle Eastern traditions that continued throughout the Middle Ages. I also think the Byzantines retained javelins among some of their units. In general, javelins were outmoded in the West but the Byzantines and their Middle Eastern rivals used them because they didn't use the crossbow there.