Judge David G. Eynon scolded Edwin DeLeon over the threats made last April.
"There are a lot of people who are very lucky you didn't get your hands on weapons," Eynon said, noting recent deadly school shootings, including one in nearby Lancaster County, Pa.
DeLeon and three other teens pleaded guilty in the scheme to shoot students and teachers. Authorities said they planned to open fire at Winslow Township High School in Camden County, where DeLeon and two of the others were students.
Despite attempts, the teens failed to get a gun before school officials heard about the plans and the boys were arrested.
DeLeon apologized in court, telling the judge, "I regret ever thinking of this idea. I didn't mean for it to get out of hand like it did."
One other boy, Peter Cunningham, was sentenced to five years in prison. Penalties for the other two boys are being handled in juvenile court.