|Spicules are one of the basic elements in the chromosphere in quiet regions of the Sun. They have lengths of 4--10 Mm, lifetimes of 1--7 minutes, and maximum upward speeds of 20--100 km/s. They are considered to be ejected by waves or energy release events. We investigate the formation process of spicules using two-dimensional radiative magnetohydrodynamic simulations covering from the upper convection zone to the lower corona. Many chromospheric jets are produced in the simulations by shock waves passing through the transition region. We find that these jets are ejected farther outward when the coronal temperature is lower (similar to that in coronal holes) and shorter when the coronal temperature is higher (similar to that in active regions). This result is qualitatively consistent with the suggestion in the previous study by one-dimensional hydrodynamic simulations, while the dependence on the coronal temperature is much weaker suggesting a strong cooling effect on the dynamics.