a. Provided a person complies with the requirements of subsection j. of this section, N.J.S.2C:39-5 does not apply to:

     (1)     Members of the Armed Forces of the United States or of the National Guard while actually on duty, or while traveling between places of duty and carrying authorized weapons in the manner prescribed by the appropriate military authorities;

     (2)     Federal law enforcement officers, and any other federal officers and employees required to carry firearms in the performance of their official duties;

     (3)     Members of the State Police and, under conditions prescribed by the superintendent, members of the Marine Law Enforcement Bureau of the Division of State Police;

     (4)     A sheriff, undersheriff, sheriff’s officer, county prosecutor, assistant prosecutor, prosecutor’s detective or investigator, deputy attorney general or State investigator employed by the Division of Criminal Justice of the Department of Law and Public Safety, investigator employed by the State Commission of Investigation, inspector of the Alcoholic Beverage Control Enforcement Bureau of the Division of State Police in the Department of Law and Public Safety authorized to carry such weapons by the Superintendent of State Police, State park police officer, or State conservation officer;

     (5)     Except as hereinafter provided, a prison or jail warden of any penal institution in this State or his deputies, or an employee of the Department of Corrections engaged in the interstate transportation of convicted offenders, while in the performance of his duties, and when required to possess the weapon by his superior officer, or a corrections officer or keeper of a penal institution in this State at all times while in the State of New Jersey, provided he annually passes an examination approved by the superintendent testing his proficiency in the handling of firearms;

     (6)     A civilian employee of the United States Government under the supervision of the commanding officer of any post, camp, station, base or other military or naval installation located in this State who is required, in the performance of his official duties, to carry firearms, and who is authorized to carry such firearms by said commanding officer, while in the actual performance of his official duties;

     (7) (a) A regularly employed member, including a detective, of the police department of any county or municipality, or of any State, interstate, municipal or county park police force or boulevard police force, at all times while in the State of New Jersey;

     (b