We propose a novel distance metric learning method (DMLMJ) for classification. DMLMJ is simple to implement and it can be solved analytically. We extend DMLMJ into a kernelized version to tackle non-linear problems. Experiments on several data sets show the effectiveness of the proposed method.