If I paid my prime contractor and he did not pay the sub contractors for the work that was done can the subcontractors come after me to recoup their money
The short (but frustrating) answer is that it depends. As a general premise, NJ Courts tend to disfavor an owner paying twice for the same improvment to his or her property. However, paying your prime contractor in full will not always protect you. See AEG Holdings LLC v. Tri-Gems Builders, Inc. , 347 N.J. Super. 511 (wherein the owner who paid his prime contractor ahead of actual progress on the project was found to be liable to a subcontractor when the prime contractor declared bankruptcy).
How did you find out about the unpaid subs? Is the construction complete? I would caution you to be very careful about making any payments to any party with whom you did not directly contract. If liens are being filed by the subcontractors, you should probably review the matter with a NJ attorney who understands construction law.