Sadly, what the court told you is correct. NJ has some very tenant friendly laws regarding evictions. You can't throw their stuff out; you can't have the police remove them; you can't file evictions proceedings; The person is legally allowed to stay in the apartment until the building does something to get them out. Heck, if you lock them out, they can call the police and get YOU in trouble if you refuse to let them back in. That's the ropes in NJ. Don't listen to what ANYONE else on this site tells you; I just had the same exact problem in June, trust me man.
Your only recourse (as I just learned) is to either have the building management evict them or let them stay their course and then take them to small claims court to get the rent they didn't pay. When I pursued management initiated eviction, it scared the person out. That was lucky because I think the building may have gotten angry at me for getting them involved. They could force you to pay legal fees, and if subletting is against the rules of your lease, you risk the building turning around and evicting you as well for breaking the lease terms. fortunately in my predicament, I had authority from management to let the person live there, despite not being on the lease. But it sounded like if I was forced to use their attorneys for the eviction, I wouldve had to pay some fees or have it taken out of my deposit.