Context. The Javalambre Photometric Local Universe Survey (J-PLUS) has obtained precise photometry in twelve specially designed filters for large numbers of Galactic stars. Deriving their precise stellar atmospheric parameters and individual elemental abundances is crucial for studies of Galactic structure, and the assembly history and chemical evolution of our Galaxy. Aims. Our goal is to estimate not only stellar parameters (effective temperature, T eff , surface gravity, log g, and metallicity, [Fe/H]), but also [α/Fe] and four elemental abundances ([C/Fe], [N/Fe], [Mg/Fe], and [Ca/Fe]) using data from J-PLUS DR1. Methods. By combining recalibrated photometric data from J-PLUS DR1, Gaia DR2, and spectroscopic labels from LAMOST, we design and train a set of cost-sensitive neural networks, the CSNet, to learn the non-linear mapping from stellar colors to their labels. Special attention is paid to the poorly populated regions of the label space by giving different weights according to their density distribution.Results. We have achieved precisions of δ T eff ∼ 55 K, δ log g ∼ 0.15 dex, and δ [Fe/H] ∼ 0.07 dex, respectively, over a wide range of temperature, surface gravity, and metallicity. The uncertainties of the abundance estimates for [α/Fe] and the four individual elements are in the range 0.04-0.08 dex. We compare our parameter and abundance estimates with those from other spectroscopic catalogs such as APOGEE and GALAH, and find an overall good agreement. Conclusions. Our results demonstrate the potential of well-designed, high-quality photometric data for determinations of stellar parameters as well as individual elemental abundances. Applying the method to J-PLUS DR1, we have obtained the aforementioned parameters for about two million stars, providing an outstanding data set for chemo-dynamic analyses of the Milky Way. The catalog of the estimated parameters is publicly accessible.