Stony Brook University police have charged a Brooklyn man, saying he threatened his ex-girlfriend while carrying a gun and a meat cleaver on campus, officials said.

Joseph Bryan Lloyd, 30, threatened his ex-girlfriend, a graduate student in the school's Social and Behavioral Sciences Building, after he forced his way into her office there wearing a wig, according to Robert J. Lenahan, chief of police, assistant vice president for campus safety for Stony Brook.

The woman called 911 about 3:15 p.m. Saturday and was transferred to the university.

Lloyd took the woman's cellphone, but she was able to run away before police arrived, officials said.

University police searched the campus and found Lloyd waiting on the Stony Brook Long Island Rail Road platform.

When officers tried to confront him, he ran across Circle Road into the woods, officials said.

Officers chased him through the woods, where he was captured.

Sign up for The Classroom newsletter. Education on Long Island is changing. Find out how. By clicking Sign up, you agree to our privacy policy.

He was found with an unloaded .38 handgun and a backpack containing the meat cleaver and the wig, officials said.

Lloyd was charged with second-degree robbery and burglary, criminal possession of a weapon on school grounds, criminal possession of a firearm, possession of stolen property and menacing.

He was arraigned Sunday in Suffolk First District Court, where he pleaded not guilty, with cash bail set at $120,000 and bond at $240,000.