Set them to 'Hold Formation' instead of skirmish, or they will run before the target is in range 90% of the time. This is a helpful hint for using javelin units that I picked up from the members here.