OSX Yosemite doesn't come with Java installed and ifg you had it before it'll be removed. You have two possible options:
Install Apple Java (1.6) for OSX
This version of Java is older than the latest available from Oracle but many Java apps running on OSX require this version. For example many of the Jetbrains IDEs recommend using this version of the
Install Oracle Java for OSX
This is a much newer and more regularly updated version of Java howvever it has suffered reliability and security issues. One of the reasons for Apple no longer bundling Java with the OS is due to these problems.
So in summary you could install the older, more stable Java or the newer less stable version. It entirely depends on the needs you and the application have.
Further Reading