Minecraft needs a certain Java version for each version of the game. If you do not have the correct version installed, Minecraft will not work.
Certain Minecraft versions need specific versions of Java. Below, is a table to help tell you which version you need and download links respectively.