Whenever you are preserving foods, the ingredients should be as fresh as possible. Pack the fruit or vegetables into jars, seal with the lids and then process (bring to the boil and boil for at least 20 minutes) in the sealed jars. If the ingredients are not to be processed, any air bubbles should be removed by pushing the ingredients down with a fork. They should then always remain covered with their preserving liquid (oil, vinegar, syrup and so on).
When making jam, I have learned from my mother-in-law to spoon the hot jam into the clean sterilised jars, close the lids tightly and turn the jars upside down. They are left there, covered with a tea towel to cool completely. This creates a vacuum that can be seen on the lid, ensuring no air remains in the jars. The jars can then be stored upright in a cool, dark place for a few months. While it is safer to boil the jars, this is a quick and effective method. However, the time they will last depends on the amount of sugar you have used as it acts as preserving agent, so take special care when little sugar is used.