Generally this is not possible.
$J = \frac{kg m^2}{s^2}$
If we try to convert you units:
$\frac{J}{m^2} = \frac{kg}{s^2} = 1000 \frac{g}{s^2}$
Obviously, squared seconds are not the same as centimetre. But tell us what is the actual variable and maybe we can help. There are cases when some constants are involved. For example, energy is sometimes measured in $cm^{-1}$ and you can convert that to Joules if you multiply the number by Planck constant and the speed of light.
As kaine mentioned in the comment, there might be some charasteristic acceleration involved. If we divide $\frac{g}{s^2}$ by some charasteristic acceleration (for example, gravitational), we can obtain $\frac{g}{cm}$.