Context. Ultracool dwarfs (UCDs) comprise the lowest mass members of the stellar population and brown dwarfs, from M7 V to cooler objects with L, T, and Y spectral types. Most of them have been discovered using wide-field imaging surveys, for which the Virtual Observatory (VO) has proven to be of great utility. Aims. We aim to perform a search for UCDs in the entire Javalambre Photometric Local Universe Survey (J-PLUS) second data release (2176 deg2) following a VO methodology. We also explore the ability to reproduce this search with a purely machine learning (ML)-based methodology that relies solely on J-PLUS photometry. Methods. We followed three different approaches based on parallaxes, proper motions, and colours, respectively, using the VOSA tool to estimate the effective temperatures and complement J-PLUS photometry with other catalogues in the optical and infrared. For the ML methodology, we built a two-step method based on principal component analysis and support vector machine algorithms. Results. We identified a total of 7827 new candidate UCDs, which represents an increase of about 135% in the number of UCDs reported in the sky coverage of the J-PLUS second data release. Among the candidate UCDs, we found 122 possible unresolved binary systems, 78 wide multiple systems, and 48 objects with a high Bayesian probability of belonging to a young association. We also identified four objects with strong excess in the filter corresponding to the Ca ii H and K emission lines and four other objects with excess emission in the Hα filter. Follow-up spectroscopic observations of two of them indicate they are normal late-M dwarfs. With the ML approach, we obtained a recall score of 92% and 91% in the 20 × 20 deg2 regions used for testing and blind testing, respectively. Conclusions. We consolidated the proposed search methodology for UCDs, which will be used in deeper and larger upcoming surveys such as J-PAS and Euclid. We concluded that the ML methodology is more efficient in the sense that it allows for a larger number of true negatives to be discarded prior to analysis with VOSA, although it is more photometrically restrictive.