When tossed a javelin is pretty much a one and done attack until you retrieve it. Even if one assumes multiple are carried their bulk would limit the number that could be brought along and still allow for effective combat, unless that factor is ignored for game convenience.
Perhaps a thrown spear could be simulated by the player being automatically swapped to their other weapon and then unable to use the spear again until it is retrieved, somewhat like not being able to access your pack when slain until you collect it again.
That would allow it to function as a melee weapon until thrown, and also simulate the denial of use of it once thrown until it is once again in the character's possession. The secondary weapon ensures the character is never completely disarmed, unless it too is a spear that will be thrown. If so, good luck punching any surviving enemies into submission.