Java questions...

Discussion in 'Mac Basics and Help' started by Texas_Toast, May 21, 2019.

  1. Texas_Toast macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #1
    Hi there. I want to install OpenOffice onto my newer Retina running Sierra, and possibly LibreOffice.

    I believe one or both require Java.

    And so I have some questions...

    1.) How do I tell if I have Java on my Mac?

    2.) How do I tell which version of Java I have?

    3.) Is it true that Oracle now requires you to register with them in order to download Java?

    4.) How do I tell if I have Java SE or the JRE installed on my Mac?

    5.) How do I upgrade Java on my Mac?

    6.) I thought that Java was considered a "security risk"? Is this true?

    Thanks!
     
  2. Loki.Mephisto macrumors 6502a

    Loki.Mephisto

    Joined:
    Feb 12, 2005
    Location:
    Germany / Austria - Mozart, no Kangaroos!
    #2
  3. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #3

    The answer to all of the above, is "java --version". The previous answer forgot the --. Not putting the -- will try and load a java program called version, instead of asking java what version it is.

    Only certain variants; Not for regular consumers. Plus, you don't necessarily need Oracle's version of Java. Any Java Runtime will do.

    Well, you can either download the latest version off of Oracle's website (or any JRE site), and from then on out, it should regularly notify about updates on its own. If the "official" Java is installed, there'll also be a pane in System Preferences for settings, manual updates - and it's an alternative way of checking version I suppose.

    A better way of keeping it up to date, and which also allows for easily managing several versions of Java at once - is using homebrew to install Java and update with brew upgrade.

    Not really, per se. Java can be a security risk, if it is not kept up to date, but it's not something I'd advice worrying too much about. Java is still very used, and in fact, almost the entire application stack of Android runs Java. Nearly every app on Android is a Java program. In fact, for many years, Android only ran Java apps.

    And btw, when I say keeping it up to date, it doesn't necessarily mean the latest feature release, like Java 12 which I believe is the latest right now - just the latest patch release. This could be Java 8 Update 202
     
  4. NoBoMac macrumors 68020

    Joined:
    Jul 1, 2014
    #4
    Sorta true. Most functions of LibreOffice and OpenOffice do not need Java. The big exception is the Base component (aka. Access-like function).

    As most people probably do not do database queries from the office tools, don't need to worry about Java.

    https://www.libreoffice.org/get-help/system-requirements/

     
  5. Loki.Mephisto, May 21, 2019
    Last edited: May 21, 2019

    Loki.Mephisto macrumors 6502a

    Loki.Mephisto

    Joined:
    Feb 12, 2005
    Location:
    Germany / Austria - Mozart, no Kangaroos!
    #5
    I believe you're wrong here. Verbatim from my Terminal:

    java -version

    java version "1.8.0_171"

    Java(TM) SE Runtime Environment (build 1.8.0_171-b11)

    Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

    Your version with double dashes yields:

    java --version

    Unrecognized option: --version

    Error: Could not create the Java Virtual Machine.

    Error: A fatal exception has occurred. Program will exit.
     
  6. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #6

    Fascinating. I see your version is the HotSpot JVM. It apparently has different syntax.
    Traditionally, a single dash is for one letter options, and double dashes are for multicharacter options.
    I have the OpenJDK variant of the JVM, and it runs fine with double dashes, but apparently also accepts single dash, I just checked.

    Code:
    Caspers-iMac:bin Casper$ java --version
    openjdk 12.0.1 2019-04-16
    OpenJDK Runtime Environment (build 12.0.1+12)
    OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
    Caspers-iMac:bin Casper$ java -version
    openjdk version "12.0.1" 2019-04-16
    OpenJDK Runtime Environment (build 12.0.1+12)
    OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
    Caspers-iMac:bin Casper$
    
     
  7. Loki.Mephisto macrumors 6502a

    Loki.Mephisto

    Joined:
    Feb 12, 2005
    Location:
    Germany / Austria - Mozart, no Kangaroos!
    #7
    Interesting indeed... apparently the open versions depart quite a bit from Oracle's now that Oracle has opened Pandora's box license-wise.
    Last time I checked ('bout a year) Google's Cloud SDK (I use for development) required the canonical JDK from Oracle, therefore I installed Oracles Java version. Not that I like it though (given the license changes)
     
  8. Texas_Toast thread starter macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #8
    I am installing OpenOffice and/or LibreOffice so I can use Base... ;-)
    --- Post Merged, May 21, 2019 ---
    When I tried that on my older Mac yesterday, it did require me to register to which I bulked.

    And based on a post after yours, apparently there is no Java on my Retina with Sierra out-of-the-box.

    So how can I get a *safe* version of Java and not have to surrender to Oracle?
     
  9. Loki.Mephisto, May 21, 2019
    Last edited: May 21, 2019

    Loki.Mephisto macrumors 6502a

    Loki.Mephisto

    Joined:
    Feb 12, 2005
    Location:
    Germany / Austria - Mozart, no Kangaroos!
    #9
    Edit: disregard, wrong statement. Apparently Oracle changed this.

    I would do the following: install Homebrew (see: https://brew.sh). No worries, its pretty easy

    Once its installed, install java:

    brew tap caskroom/versions

    To install Java 8:

    brew cask install java8

    for latest version:

    brew cask install java
     
  10. Texas_Toast thread starter macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #10
    What is Homebrew?

    Is it safe?

    Why is Oracle being such a jerk and requiring registration?

    Is Java no longer free?
     
  11. Loki.Mephisto macrumors 6502a

    Loki.Mephisto

    Joined:
    Feb 12, 2005
    Location:
    Germany / Austria - Mozart, no Kangaroos!
    #11
    Yes, I consider brew safe. It pretty much a standard tool for programmers and power users on the Mac; it is kind of inspired by Linux package managers (like apt/pacman/yast, etc). Very useful indeed.

    Java is still kinda free for private users. Oracle, however, decided there are no longer public updates for commercial users. So, informally, commercial users have to buy subscription in order to receive updates and/or support. Or choose a different option, like using OpenJDK or third party alternatives (IBMs Java, e.g.)
     
  12. Texas_Toast thread starter macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #12
    I thought I heard somewhere tha you can download the latest version of Java (Java12) without registering, but if you want older versions then you need to register?

    If I am able to install the latest version of Java, don't you think that OpenOffice should be able to run off of that? (Seems kind of strange to have to install an outdated version of Java to get OO to work, right?)
     
  13. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #13
    Java 7 and above lost compatability with some Java6 and earlier programs. I don't know how these apps are written, but if they rely on old Java, you'll need the legacy Java - but you can get that straight from Apple, since it used to be a built-in part of macOS, and Apple still distributes the legacy package for newer OSes.

    If it runs on anything newer than Java6, just get any version you want.

    The homebrew method is really by far the easiest though.

    brew cask install java

    Done. You have Java.
    Need to update it?
    brew upgrade

    Done.
     
  14. Loki.Mephisto macrumors 6502a

    Loki.Mephisto

    Joined:
    Feb 12, 2005
    Location:
    Germany / Austria - Mozart, no Kangaroos!
    #14
    I'd install LibreOffice rather than OpenOffice; OpenOffice's development is rather slow, LibreOffice far more actively developed. Unless you have a specific reason/requirement you should be fine without Java.
     
  15. Texas_Toast thread starter macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #15
    Yes, I have decided to try out LibreOffice over OpenOffice - at least on my Retina - but I will need Java since I want to use the database called "Base".

    On my Retina running Sierra, when I go to System Preferences > Java, I see that I have build 1.8.0_211-b12

    How did that get there, because I thought macs did not come with Java installed?

    At any rate, it sounds like if I want to run LibreOffice Base using Java8 it should work?

    But if I want to run OpenOffice base then it may not work because it may need Java 6?
     
  16. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #16
    Macs do not come with Java anymore, no. But you probably just installed it without remembering, or perhaps without knowing; Another program you installed could perhaps have packaged Java with it.

    If your computer tries to perform an action that requires Java 6, a message will appear saying it needs legacy Java, with a button labelled "Learn More" with a link to downloading it straight from Apple.
    I don't think either Office suite requires the legacy Java package, but the easiest thing to do is just to try and run whatever you want to run, isn't it?
     
  17. Texas_Toast thread starter macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #17
    Okay.


    Is there a link where I can download a copy of Java6 from Apple just to have on hand and yet not install?


    Yeah, I know, I just get paranoid about breaking my Mac by uninstalling/installing stuff.

    I'm going to download LibreOffice now and give it a whirl!
     
  18. jtara macrumors 68000

    Joined:
    Mar 23, 2009
    #18
    Java is a programming language, library, and runtime system. It's as safe/unsafe as any programming language/library/runtime system. It's a meaningless statement. With ANY desktop application, regardless of language, you need to decide if you trust the publisher.

    Java BROWSER EXTENSIONS are considered unsafe. As are Flash, Silverlight, and any browser extension that allows a random website to download code that can access your local filesystem outside of a sandbox. Although some/all of these have evolved over time and added sandbox features, they've also been historically buggy, and hackers have from time to time figured out ways to break out of any sandboxes.

    There is a lot of confusion about Java, because most people's introduction to Java was as a browser extension.

    Javascript (which has NOTHING to do with Java) is considered relatively safe. It is embedded in (almost) every browser (there are some special-purpose browsers that don't have Javascript, and you can disable it in most/all browsers) and browser publishers have gone to a great deal of trouble to make it safe. And no browser javascript implementation that I know of provides any way to access the local filesystem (outside of the browser's sandbox) other than under direct user control. (e.g. a popup to allow the user to select a file to upload or location to save a downloaded file.)
     
  19. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #19
    https://support.apple.com/kb/dl1572?locale=en_US
    It seems it doesn't list Mojave in the list of operating systems it's designed for, but pretty sure it still works.

    Why would that break anything? There's fundamentally no real difference between data and programs.
    --- Post Merged, May 23, 2019 ---
    Well; I'd redefine that to say "as safe as any [all of what you said] that runs on an abstract machine"
    Since the JVM is an additional layer in the software stack, vulnerabilities in the JVM would give an extra attack vector, not present in traditionally compiled Mach-O binaries. - But aside from that I agree with all your points :)
     
  20. jtara macrumors 68000

    Joined:
    Mar 23, 2009
    #20
    No.

    If anything, that it runs on an abstract machine, it reduces somewhat the potential for vulnerabilities. EXCEPT from the standpoint of the general principle of "the more code there is, the more likely there is for it to have a bug", or "the more likely it is that there is surreptitiously-implanted evil code". (Needle in haystack.)

    But abstract machines typically have SOME limitations vs. pure machine code. Not that it really matters...

    I don't write Java code (OK, well, as little as possible... I work primarily in Ruby - another language that in most implementations "runs on an abstract machine" - and I've worked extensively in C and C++ in the past) so I don't know if there is some Java library that will allow calls to any arbitrary Objective-C framework and/or underlying OS calls. But pure executable code can call ANY userland function, which is enough to read/write any file that the user running the app has access to.

    Executable code has the MOST potential to royally mess-up your system. But Java or Ruby or pretty much any programming language/interpreter that does not sandbox files has sufficient power to royally mess things up without your knowledge or control. Pure machine code can royally mess it up in some different ways that might not be possible otherwise, but like I said above, it doesn't matter.

    To be the safest, ONLY install applications that you download from the MacOS App Store. At least then they've been vetted by Apple. Still, they have great potential to do harm, because Apple can't catch every possible possibility.
    --- Post Merged, May 23, 2019 ---
    Probably was installed by the installer for some application you installed that needs it.
     
  21. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #21
    Well, Java was primarily made with the idea of write once run anywhere, so interacting with system calls is greatly discouraged since you can't rely on them being on any system; Though you can do system calls, yes. Though it's frankly a bit of a hassle

    Anyways, you're right that the abstract machine can enforce restrictions that native could isn't subjected to that can be seen as a security safeguard - Though actually AppKit/UIKit/.NET code is too - And that's a very fair point. I actually wrote an abstract machine myself recently, including a validation layer.
    But I was more thinking in the sense that a flaw in the JVM could be an attack vector into all Java programs on the system. Even if the malicious part couldn't escape the JVM that's still a lot of potential damage. Not as bad as native malware being able to inflict all apps, but my thought was that native code will run no matter what. Java code requires Java, so the JVM is an additional attack vector.
    I'd say there are valid points on both sides here, but I disagree with none of your ultimate conclusions.


    And even sandboxing isn't always a bulletproof solution. There've been a few sandbox escapes in the past.
     
  22. Texas_Toast thread starter macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #22
    Where does the Java used by browsers exist?

    Is it the same Java that is in your /Application directory?
     
  23. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #23
    You don't need to worry from a security perspective. Safari - and basically any browser - will block Java applets on the web if you don't explicitly allow on a per-site basis.

    But yes, it's the same Java - generally anyways. I don't know if there exists a JVM that doesn't have one or the other.
     
  24. Texas_Toast thread starter macrumors 6502a

    Texas_Toast

    Joined:
    Feb 6, 2016
    Location:
    Texas
    #24
    I just downloaded and installed LibreOffice 6.2.4.2, and when I opened up Base and chose the database wizard, I got this error...

    "LibreOffice requires Oracle's Java Development Kit (JDK) on Mac OSX 10.10 or greater to perform this task. Please install them and restart LibreOffice."


    So what do I do now?

    a.) I thought I had the Java 8 JDK on my Mac? Or did I just have the Java 8 JRE?

    b.) How can I tell?

    c.) Can I downloaded the Java JDK for free?

    d.) Am I going to have to register with Oracle?

    e.) Do I install the JDK over what I have, or do I have to uninstall Java 8?

    f.) Am I going to break other software using Java by doing all of this?

    This is starting to look like a real mess!! :(
     
  25. jtara macrumors 68000

    Joined:
    Mar 23, 2009
    #25
    No mess at all. The sky is NOT falling. But if you keep repeating that the sky is falling, it just might. ;)

    Multiple versions of Java do now and always have coexisted on the same system. It was designed to work that way. I *think* apps look for the highest version within the range of versions they were designed to support. (Like I said, I am NOT a Java developer - I use it because it is required by various applications I use.)

    You have to register with Oracle to download certain OLDER versions of Java. (1.8, 1.7). You can download the CURRENT version (12.0.1) without registration. LIke many software vendors, Oracle is trying to discourage installation of older versions. (Like Google Chrome, that really pushes you to update to the latest.) It reduces support burden to get as many people as possible onto the very latest version, because the developers are working on the next one after that, and don't want to be bothered with patching old ones.

    The version numbering scheme changed along the way. It was numbered 1.0, 1.1, etc. through 1.8, then instead of 1.9, the next version was 9.0. I guess they couldn't stand the cognitive dissonance of 1.10. Two digits blew some marketing guy's mind.

    See attached screen shot.

    There is no cost to register.

    There are licensing requirements that vary by version. If you are going to use it commercially, embed in a product, etc. there are some new licensing requirements that will require payment. I am fuzzy, as I have no intention of developing applications with a language that I do not program in. For end users, there are no license fees.

    This is basically much ado about nothing. I don't get the reluctance to register. They want a record of the fact that you accepted the licensing terms. (Which of course almost nobody ever reads...) And they want to be able to compile impressive statistics about how many installations they have and where, etc.

    java.png
     

Share This Page

30 May 21, 2019