There are all sorts of ways to sterilise jars. The easiest one, I find, is to wash them in very hot soapy water, rinse the soap off, dry them and put them into the oven at a low setting, e. g. gas mark 2/100°C for 10 minutes.
My dishwasher has a sterilising programme. If I'm making larger quantities I run my jars through this programme.
Leave to cool if you're filling them with something cold such as pesto or marinated olives. Hot contents such as jams can be poured in straight away.