For preserves, jars are sterilised and, once filled, heated in a water bath or pressure canner so bacteria cannot grow. In mushroom growing, grain and some substrates are sterilised in a pressure cooker so only the mycelium grows.
It is not the same as pasteurising, which only reduces microbes at lower temperatures. For low-acid vegetable preserves, the method and time matter a great deal because of the risk of botulism.

