The excitation of harmonic waves by an electron beam is studied with electrostatic simulations. The results suggest that the harmonic waves are excited during the linear stage of the simulation and are developed in the nonlinear stage. First, the Langmuir waves (LWs) are excited by the beam electrons. Then the coupling of the forward propagating LWs and beam modes will excite the second harmonic waves. The third harmonic waves will be produced if the lower velocity side of the beam still has a positive velocity gradient. The beam velocity decreases at the same time, which provides the energy for wave excitation. We find that it is difficult to excite the harmonic waves with the increase of the thermal velocity of the beam electrons. The beam electrons will be heated after waves are excited, and then the part of the forward propagating LWs will turn into electron acoustic waves under the condition with a large enough intensity of beam electrons. Moreover, the action of ions hardly affects the formation of harmonic waves.