Installing java on raspberry pi?

I tried this method: http://www.howtogeek.com/173044/how-to-run-low-cost-minecraft-on-a-raspberry-pi-for-block-building-on-the-cheap/ to get a minecraft server running (except a didn't run over an ash or command line as I prefer the desktop environment) and I tried their java command but my pi came back with a 404 error and "no such directory exists" when I tried to check the java version (it said it had downloaded files weirdly) how can I get java on my pi?

Thanks

Added (1). Didn't run it over ssh

In Raspban on a Pi, there ar far easier ways to install than downloading from a website.
Go via the menu System section to Synaptic Package Manager, supply your password, refresh the repository lists, then search java. That will list the packages to install, tick them and click Apply.