The Jagiellonian Positron Emission Tomograph (J-PET) is the first PET device built from plastic scintillators. It is a multi-purpose detector designed for medical imaging and for studies of properties of positronium atoms in porous matter and in living organisms. In this article we report on the commissioning of the J-PET detector in view of studies of positronium decays. We present results of analysis of the positron lifetime measured in the porous polymer. The obtained results prove that J-PET is capable of performing simultaneous imaging of the density distribution of annihilation points as well as positron annihilation lifetime spectroscopy.