Aims. Recently a tentative identification of CH2D+ in interstellar space has been reported. To facilitate astronomical identifications, laboratory measurements of precise rest frequencies for the rotational lines of CH2D+ should be carried out. Methods. A submillimeter-wave spectrometer is used for detection of CH2D+. The CH2D+ ion is generated in an extended negative glow discharge operated at liquid nitrogen temperature. The optimum gas mixture is found to be CH4 (similar to 3 mTorr), CD4 (similar to 1 mTorr), and H-2 (similar to 2 mTorr) in helium buffer. Results. Four rotational lines have been detected in the frequency range of 280-890 GHz. The measured frequencies agree very well within a MHz with the predictions given by Rosslein et al. from the infrared spectra. Conclusions. Two rotational lines of this ion have been tentatively identified toward Ori IRc2. The rest frequencies obtained here should facilitate identifications and analysis of astronomical spectra.