If you have a gym membership that includes classes or they have affordable ones at your nearby park district or whatnot (or at the place where you are taking classes), they can be a great way to help give you a little structure while you are building habits.
Also it really helps to try and include stuff you are interested in. If you don't like running, don't like elliptical machines, whatever, of course going to the gym to do those things is going to feel like punishment. Find things you enjoy or you've always wanted to try. Park districts in my area sometimes offer free or inexpensive intro/preview classes to get people trying things they might be curious about so they sign up for it if they like it, like water aerobics samplers, zumba, nia, etc. Or if your gym has classes, why not try something you've never tried that sounds interesting. Many running stores around here offer free or cheap c25k type classes for wanna-be runners, which give you a training plan and usually schedule 1 or 2 group runs a week.
My husband goes to the gym too but he really doesn't like to do cardio grinds for very long. Oh and he hates those classes at the gym - I've been trying to get him to go spin with me for years but nooo. So instead, he loves hockey so when I started to get active, he signed up for skating lessons to refresh his skills and now takes hockey classes. Sometimes during his lunch break or after work he goes over to the rink near his work and does some extra skating. Since he got into something he loves, he's been far more consistent with his exercise. Even going to the gym now has a purpose - he has planned strength/cardio workouts designed around what he's read/been told works best for hockey players and is happy to do anything that will help his hockey playing passion.