Java is a programming language that is supposed to be cross-platform and ease development cycles across multiple platforms. It was originally owned by Sun, which was bought by Oracle.
The idea was that a set of API's (I've likely got that wrong) would be written for every Operating System (OS) which Java would call to perform its cross-platform magic. In all other OS's, Sun developed the API intefaces, frameworks, or whatever for all the OS's except OS X. Apple chosed to develop them. However, that became a lot of effort for very little return, so Apple dumped that support (very rightly so, IMO).
In this transition period, Apple is still trying to patch the seemingly infinite holes in Java 6 (or 1.6 in the Java world) while Oracle tries to provide the Java 7 support for OS X. As Apple has dropped pretty much all 32-bit code with 10.8, so, apparently has Oracle with Java.
Now, there are two flavors (of any import) of Java, the Java Development Kit (JDK) and the Java Runtime Environment (JRE). The JDK is for developing Java applications. The JRE is for running Java applications on a particular OS (that's the "API" part I was talking about). The JRE supports the WebStart plugins that allows Java web applications to run on a particular OS.
If you are running a standalone application that doesn't connect to the internet at all, it really doesn't matter what version of Java is hosting it. Just running an application doesn't necesarily open a gateway for people to hack your computer. It is the fact that it runs from a Web application that makes it problematic. That doesn't mean the someone can't trick you into installing a "standalone" Java application that can have nefarious intentions. It's just easier as a weblet.
I realize that /usr/bin/java is the Apple supplied Java 6 - but is it the JDK or the JRE? I get the impression that /usr/bin/java is the JDK.
One thing I'm finding is that there is/was a radical difference between Apple's installation of Java and Oracle's. Not the least of which is statements like "Under Apple's implementation of Java, it was possible to have multiple JREs installed, and the Java Preferences app was used to determine the first compatible version that would be used. The following instructions show how to change the default JRE." from Oracle. The companion fact is that the Java Preferences App found in utilities has been replaced by the Java Preferences Panel under System Preferences.
The thing I'm seeing implied, but have not yet found a definitive statement about, (other than the one implied by Linc Davis) -- The JRE from Oracle is distributed as an "Internet Plugin" (not to be confused with a "Web (or browser) Plugin." -- whatever those terms mean.
Similarly, I find that /library/java/JavaVirtualMachines is an empty directory. And that
/library/Internet Plug-Ins contains JavaAppletPlugin.plugin
The java utilities in /usr/bin are nothing more than symlinks to the identical binaries found under /System/LibraryJavaVM.framework/Version/Current/Commands.
That nominally points to Java SE 6, and is completely obsolete (unless you are using Snow Leopard). Apple stopped distributing Java for OS X, and Oracle took it back over, with Java SE 7.
The JRE is the runtime environment and the JDK is the development kit. The key difference is that the JDK comes with all the development library .jar files that developers need in order to write software that uses Java's built in libraries and classes.
The Oracle JRE is only distributed as an internet plugin, to allow browsers to run Applets. In order to do development, or run standalone applications with an up to date version of Java, you need to download and install the Oracle JDK, which will then populate /Library/Java/JavaVirtualMachines and cause some "under-the-hood" magic so that the binaries in /System/Library/JavaVM.framework redirect to the up-to-date version.
Message was edited by: g_wolfman, to fix a couple of typos
The question I was trying to resolve is -- what version of "Java" (whatever that means) do I have installed? The unasked question which also needed to be answered is, "what IS Java?" It turns out that Java is TWO things -- the JDK and the JRE. And, as you will note below, they do have "unexpected interactions"
It appeared that I had two different versions installed, which turned out to be true.
The JDK was Apple's SE 6, and the JRE was Oracle's SE 7.
Other than trying to understand what I was seeing -- i.e why Oracle claimed I was running the latest Java 7, when I could clearly see that it was Java 6.
As for the specific problem: I am trying to debug an applicaiton whcih was running fine for me, but not for someone else. We apparently had different Java setups. And in fact, it turned out that we did. When I replaced my 6.x JDK with the 7.x JDK, the application stopped working.
So, now I know that the issue is with the Java program itself, not with the instalation of Java on OSX.