The sentence was handed down Monday after the 17-year-old admitted to felony counts of possessing and discharging a firearm in a school zone.
The incident happened in January when police said the teenager brought a loaded 9-mm gun in his backpack.
The gun went off in class, injuring two 15-year-old students.