The Java Runtime Environment (JRE) and the Java SDK are not inherently unsafe. The problem relies for the most part in certain ways the JVM (Java Virtual Machine) accesses (and can be fooled to) certain pieces of the operating system.
Like every other complex piece of software, Java is no different than, say, .NET on a Windows machine or Mono.NET on any flavor.
Java on a browser, however, is a different world (and hence why you can go ahead and disable it in most modern browsers), similar to (but not as bad as) what ActiveX was back in the days of Internet Explorer.
You can safely have the JRE in your Macintosh, Linux or Windows machine with little danger, since no element of the Java RE or SDK will expose remote vulnerabilities by default. It's just a lot of code sitting in your Hard Drive.
Now if you want to know if executing Java software is unsafe, then there's no way to answer that without diving into huge arguments. If you want to run Java Software, just go to Oracle, download the Runtime environment and run your Java program. It will not be activated by default on Safari (but double check to be sure) or any other browser.
With all that said, Java is annoying (especially their updater, which you can tone down or disable but never ceases to be as annoying or sometimes more than the Flash Updater if you have Flash). On the other hand, Oracle finally started rolling more periodic updates to Java so vulnerabilities are taken care more often (which is annoying but good). When Apple was in control of the SDK, this wasn't the case.
Of course, some "security experts" will cry out loud that having Java in your hard drive can lead to more insecurity since someone gains access to your computer, they could exploit local Java vulnerabilities. Trust me, if anyone gains access to your computer (even remote) to the point where they can execute anything (including Java), you have a bigger problem.
So if you need it, go ahead and get it.