Java is not recognized on my macs terminal?

I'm trying to make a Minecraft Bukkit server for 1.8 and up but java doesn't work as a command in my mac's terminal. I do have the latest Java JDK but it does not work a command in my terminal… Please help.

It all started when I typed this command: #!/bin/bash cd "$(dirname "$0")" exec java -Xmx2G -Xms2G -jar spigot.jar nogui

I know this has nothing to do with your question, but I can't figure out how to privately message you. We're going with the name Jade.