8 Replies Latest reply: Feb 13, 2013 8:28 AM by William H. Magill1
William H. Magill1 Level 2 Level 2 (200 points)

I'm don't really understand Java and how it i is implement on OSX so the question and explanation needs some file names...

 

In terminal:

> which java

/usr/bin/java

> java -version

java version "1.6.0_37"

Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)

Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

 

However if I vistit: http://www.java.com/en/download/testjava.jsp

I find:

Your Java configuration is as follows:

Vendor: Oracle Corporation

Version Java SE7 Update 13

Operating system Mac OSX 10.8.2

Java Architecure: 64-bit

(This after having run the Oracle installer. Prior to that, that page showed no java being installed.)

=====================

Support Article HT5559 - Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality

Aparently only talks about the Java Plugin for Safari.

As does, Oracle's instructions to "Unistall Oracle Java 7" - http://www.java.com/en/download/help/mac_uninstall_java.xml

====================

1- It appears that "/usr/bin/java" is the Java Runtime Environment (JRE), although Oracle describes this as "a plugin." ... or is that the JDK?

 

2- So, when I run a stand-alone Java Application, (i.e. no browesr involved) what is it running? Java 6 or Java 7, and how can I tell?

 

I should add /library/java/JavaVirtualMachines is empty


iMac, OS X Mountain Lion (10.8.2), iMac Core i7 2.93GHz 4GB
  • 1. Re: explain java on mountain lion
    Barney-15E Level 8 Level 8 (35,275 points)

    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.

     

    Along comes 2013 and we find that Java is "unsafe at any speed" as Ralph Nader would describe it. It may have as many (or more) holes than Blackburn Lancashire.

     

    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.

  • 2. Re: explain java on mountain lion
    Linc Davis Level 10 Level 10 (117,895 points)

    1. Neither. It's the Apple-supplied Java 6.

    2. Java 6. The Oracle runtime is a self-contained web plugin only.

  • 3. Re: explain java on mountain lion
    William H. Magill1 Level 2 Level 2 (200 points)

    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

  • 4. Re: explain java on mountain lion
    Linc Davis Level 10 Level 10 (117,895 points)

    The operative question is, what are you trying to do, or what problem are you having?

  • 5. Re: explain java on mountain lion
    g_wolfman Level 4 Level 4 (1,120 points)

    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

  • 6. Re: explain java on mountain lion
    William H. Magill1 Level 2 Level 2 (200 points)

    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.

  • 7. Re: explain java on mountain lion
    g_wolfman Level 4 Level 4 (1,120 points)

    Did the application provide a stacktrace, or some error message which might indicate why it stopped working?

  • 8. Re: explain java on mountain lion
    William H. Magill1 Level 2 Level 2 (200 points)

    No such luck... the application never launches.

    There is so much crap in the Console Logs because of "normal" output crap from Safari (another complaint of mine), that it is not even possible to determine if any thing is being logged by the application or the OS at the time of launch.