We exhibit a three-dimensional (3D) photonic nanojet based on a dielectric microsphere irradiated by a plane wave with the finite-difference time-domain (FDTD) method. We investigate the influence of the refractive index of the surrounding on the properties of the nanojet by simulating the electric field distributions in it. The simulation results show that, by optimally choosing the size of the sphere and the ratio of the refractive indices of the sphere and the surrounding, the focus point can occur just on the surface of the sphere even if the refractive index of the surrounding is changed. Additionally, the peak amplitude of the nanojet increases with increasing the refractive index of the surrounding. However, the decay length and the jet width of the nanojet decrease simultaneously. These effects may have potential applications in observation or manipulation of nano-objects such as antibodies in biology. In nanojet-enabled optical data storage, the photonic nanojet may be also helpful for improving data-storage capacities and retrieval speed by controlling the field amplitude, the decay length, and jet width of the nanojet.