The flexible job-shop scheduling problem is known to be an (Non-deterministic Polynomial-time hard) combinatorial problem and has become a challenge in optimization and manufacturing control. Although flexibility is important in order to respond effectively to higher product variety, shorter lead times, and smaller batch sizes, industrialists also require just-in-time scheduling strategies to increase customer satisfaction. The aim of this paper is to find adequate job release times to meet production demands in relation to specific due dates. Since large deviations in job completion times are undesirable, the scheduling objective for just-in-time production is translated into the minimization of the mean-square due date deviation (MSD), quadratically penalizing inventory (earliness) costs and backlogging (tardiness) costs. Given the computational complexity of the problem, two meta-heuristics are proposed: a genetic algorithm (GA) and particle swarm optimization (PSO), as well as two different approaches to handle job release times. In the GA, job release times are treated as dependent variables, whereas the PSO enables the integration of job release times as independent variables within the particle encoding. These meta-heuristic approaches were compared using three benchmarks, two adapted from the literature and one inspired from a real manufacturing cell. The simulation results show that the GA and PSO attained similar performances, each one with advantages and disadvantages for constrained and unconstrained MSD problems.