This paper presents an approach to learn online generation of collision-free and torque-limited trajectories for industrial robots. A neural network, which is trained via reinforcement learning, is periodically invoked to predict future motions. For each robot joint, the network outputs the kinematic state that is desired at the end of the current time interval. Compliance with kinematic joint limits is ensured by the design of the action space. Given the current kinematic state and the network prediction, a trajectory for the current time interval can be computed. The main idea of our paper is to execute the predicted motion only if a collision-free and torque-limited way to continue the trajectory is known. In practice, the predicted motion is expanded by a braking trajectory and simulated using a physics engine. If the simulated trajectory complies with all safety constraints, the predicted motion is carried out. Otherwise, the braking trajectory calculated in the previous decision step serves as an alternative safe behavior. For evaluation, up to three simulated robots are trained to reach as many randomly placed target points as possible. We show that our method reliably prevents collisions with static obstacles and collisions between the robots, while generating motions that respect both torque limits and kinematic joint limits. Experiments with a real robot demonstrate that safe trajectories can be generated in real-time.