Using ionic liquid as solvent for coupling, and halogen exchange reactions