You can use a clamp like the Pick Up Trucks use for those toppers.
The factory CJ-7 has holes drilled strategically for the hols in the top of the rail. The aftermarket top not always. A lot depends on how the top was made. Some have a continuous ledge that will sit on top of the bed rim, and have hols in the fiberglass at the same point as holes in the bed edge.
The top that I have has several 4" long or so metal brackets that are bolted to the main top and then bolt to the tub. In those places you can use those Aluminum clamps to help hold it on. Those tops have so much weight that they tend not to move around anyway. If you want a little extra, put double sided sticky foam on the top and bed junction, it will give it more holding power.
Normally the front of the hard top mounts just like the factory hard top. They used to sue just sheet metal screws. I would suggest going to a Riv-nut insert instead. Lots more to grab and better threading. Sheet metal screws always seem to wallow out and come loose. I know it is not factory but I think that it is a better solution. Plus it you use the metal type you can take the edges to keep them from spinning. If you have a TIG then you can TIG a nut to the windshield frame, but then you will need to paint. It is a better more permanent solution but definitely not factory.
Here is a picture of the Topper clamp that I am thinking of.
If you want to keep from scratching the top of the body put single sided foam tape on the bottom of the hard top ledge to protect the paint and cut down on wind noise.
Carl