We study the giant resonances of stable and unstable nuclei in the framework of the consistent relativistic random phase approximation built on the nonlinear relativistic mean field (RMF) ground states. The isoscalar and isovector modes of giant resonances for stable nuclei, such as 208Pb,144Sm,116Sn,90Zr,40Ca,16O and Ca isotope chains are investigated. The contribution to the giant resonances from the Dirac sea states and the currents of vector mesons are examined. The results show that the effects of the Dirac sea states on the isoscalar giant modes are pronounced, but become weaker for light nuclei, while the contributions of the isovector modes are negligible. The few sets of parameterizations of nonlinear RMF model, which are commonly used to give a good description of ground-state properties of finite nuclei, could also well describe the nuclear dynamic properties-giant resonances. For nuclei with the extreme value of N/Z, low-lying collective excitations are found in isovector dipole modes, which are mainly due to the ph excitation of the weakly bound states near Fermi surface and the isospin mixture effect.