sb2nov / mac-setup

Installing Development environment on macOS
https://sourabhbajaj.com/mac-setup/
Other
7.15k stars 1.02k forks source link

Update install instructions for Java #282

Closed ghostwriternr closed 4 years ago

ghostwriternr commented 4 years ago

The tap caskroom/versions is no longer supported and has changed to homebrew/cask-versions. Furthermore, the recommended way for installing Java via brew is to use the AdoptOpenJDK distribution.

Also update the Oracle links with newer ones, with specific callout to the login requirement for older JDK versions.

ghostwriternr commented 4 years ago

@sb2nov gentle nudge to review when you can : )

apjanke commented 4 years ago

:+1: on this in general; IMHO nobody should be suggesting any non-enterprise users to install an Oracle JDK anymore, and AdoptOpenJDK is what most people should be using instead.

Maybe these instructions could include pointers to a bit more info and documentation to users who are new-ish to Java and wading into the whole Oracle-vs-OpenJDK licensing mess? I'm a professional Java developer, and it took me days of research to really understand this; I wouldn't expect an ordinary Java user to understand what "Oracle JDK" vs "OpenJDK" vs "AdoptOpenJDK" are, much less know how to choose between them.

Maybe these instructions could include:

And maybe the Java 8 install instructions should be relegated to a footnote at the bottom, with an explainer on why and when you might want to pick Java 8 over 11? Most non-enterprise users probably don't want Java 8 at this point.

Also, env.sh is news to me, and I'm an experienced user of various shells on macOS. Where does this file come from, and how is it sourced by the various popular shells (bash/zsh/tcsh/ksh)? The mac-setup/iTerm/README.html/iTerm/README.md file in this repo doesn't describe any env.sh file, and AFAIK that's not a standard Unix shell thing. Looks like this PR didn't introduce env.sh; maybe this has just gotten out of sync with the head of master here?

simeg commented 4 years ago

@apjanke Thanks that's useful information. I agree this section could be fleshed out a bit more.

We would appreciate a PR since you seem to be knowledgable on this topic!

apjanke commented 4 years ago

Sure. Gonna be a long work day today, but I may be able to get to it this evening or tomorrow.

apjanke commented 4 years ago

Okay, I think what my PR is going to contain, is just removing the "Using the Oracle installer" section entirely, because IMHO that's not the best thing for pretty much anybody these days, and talking about it is just going to confuse people.

NOTE: This decision is a somewhat political one in addition to a technical one, and you shouldn't just take my word here.

I'd also suggest removing the -v 11 argument to the /usr/libexec/java_home command in the "Add Java to PATH" section, because the java_home selector will get it right without that. And, actually, probably just remove the "Add Java to PATH" section altogether? A well-functioning Java toolchain on any recent Mac doesn't actually need that; explicitly adding a specific JDK/JRE to your $PATH is more of a Power User thing, or a thing to deal with broken Java builds in software packages with nonstandard build systems, and most Java stuff should work just fine without it.

simeg commented 4 years ago

I agree with everything you said @apjanke, and would approve such a PR. The current section is confusing and makes it sound unnecessarily complicated to install Java.

apjanke commented 4 years ago

Here's your PR! https://github.com/sb2nov/mac-setup/pull/285 Turns out the installation process is even simpler now than it used to be. I suggest changing the instructions to focus on installing OpenJDK, and relegate all the notes about the Oracle JDK to a special "Note for corporate users". Because it does bear mentioning a bit.

Long story short: just brew install openjdk and you're good to go now.

(Sorry if I'm being too flippant in my text here; feel free to edit it to make the tone appropriate for this document.)

apjanke commented 4 years ago

BTW, if you're confused: "OpenJDK" is the open-source Java thing, and "AdoptOpenJDK" is a campaign and website to get people to use OpenJDK instead of the alternatives. IMHO, AdoptOpenJDK is good; everyon should basically just do what they say.