The suppression of $J/\psi$ production caused by the color-screening effect in heavy-ion collisions is considered as an evidence of the creation of quark-gluon plasma.
However, the production of $J/\psi$ in hadronic collisions remains not fully understood.
Further studies are needed to provide a good understanding of its production mechanism in p+p collisions for interpreting the observed suppression in heavy-ion collisions.
Recently, the $J/\psi$ production in jets was proposed as a useful observable to help explore the $J/\psi$ production mechanism and to differentiate various $J/\psi$ production models.
We report the measurement of the fraction of charged jet transverse momentum carried by the $J/\psi$ meson, z($J/\psi$) $\equiv$ $p_{\mathrm{T}}^{\mathrm{J/\psi}}$/$p_{\mathrm{T}}^{\mathrm{jet}}$, at mid-pseudorapidity ($|\eta|<0.6$) with kinematic cuts of $p_{\mathrm{T}}^{\mathrm{jet}}>10$ GeV/c and $p_{\mathrm{T}}^{\mathrm{J/\psi}}>5$ GeV/c in p+p collisions at $\sqrt{s}$ = 500 GeV by the STAR experiment. The comparison to model calculations and similar measurements carried out at the LHC are presented, and its physics implications are discussed.