Experimental results on J/ψ production by π±, K±, p and p¯ beams at 39.5 GeV