Prick an egg with a pin before boiling and you won't get the green line around the yolk and your egg won't crack. Prick at the fat end of the egg.
OR - salt the water first, put the egg in when the water is cold. Bring to a boil and take off the heat for 15 minutes for hard boiled eggs. The salt will prevent the cracking of the egg.