How can I max black mage efficiently

JP is earned from the job you have equipped not the skills you are using.

The following should work in pretty much any random encounter (with or without other party members),

  • Set Ramza's job to Wizard.
  • Set Ramza's secondary skill set to Guts (special Squire skills) and have Yell/Tailwind learned (the Guts skill that gives +1 speed, I could be wrong on the names).
  • Enter a battle and continuously cast Yell/Tailwind. Repeat this until you have the desired amount of JP.

This is just one of many ways to farm JP effectively. Other ways can be found here.