how does system know Java is not installed?

Discussion in 'Mac OS X Lion (10.7)' started by markmacrumors, Sep 10, 2011.

  1. markmacrumors macrumors newbie

    Jun 17, 2009
    I'm adjusting the PackageMaker scripts in our installer project so we can detect whether Java is installed or not. If not, our installer can prompt the user to install it. We'd like the user to have Java installed BEFORE they finish installing our product.

    When the user upgrades from 10.6.8 to 10.7, the Java files from 10.6.8 are left on the disk. So the 10.7 System Profiler shows Java as being installed. But if I run /usr/bin/java in Terminal, the system will detect this and bring up Software Update.

    So, how can my installer bash scripts tell if Java is really installed and enabled or not? Thanks.
  2. markmacrumors thread starter macrumors newbie

    Jun 17, 2009
    What I found out is that during the update from 10.6.8 to 10.7, the update will replace all installed java programs with bogus programs. When you run one of these bogus programs, it says that it can't find the Runtime Environment, and that it will bring up the Software Updater so you can install Java for Lion.

    Based on this, I won't be able to use anything about the bogus programs to tell me whether they are from 10.6.8 or from Lion Java. But these bogus programs point to /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents which contains an Info.plist file which contains version numbers for this bogus Java installation.

    I can use these version numbers to tell whether the installed Java is 10.6 or 10.7.
  3. MisterMe macrumors G4


    Jul 17, 2002
    I take it that you are unfamiliar with Receipts.
  4. markmacrumors thread starter macrumors newbie

    Jun 17, 2009
    Thanks for this great suggestion! Receipts had slipped my mind. I was too focused on getting version info from the installed files and didn't think about one level up. Thanks again.

Share This Page