Add initial documentation for Java-based packages#10700
Add initial documentation for Java-based packages#10700MikeMcQuaid merged 1 commit intoHomebrew:masterfrom appropriate:docs-homebrew-and-java
Conversation
|
Great start! We should probably talk about the macOS system Java wrappers in We should repeat the guidance here and point out that this will enable these system Java wrappers to function properly when running e.g. % java
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java. |
|
Since |
|
Where do you see that /usr/libexec/java_home is deprecated by Apple? I note that it's actually been updated in Big Sur. We just don't use it internally in Homebrew anymore because we have other solutions that work better for us. |
|
Okay, I swear I read that during the Big Sur beta cycles. I can't find it anymore so I guess I was wrong. But since it's functionally equivalent to setting |
Apologies @SMillerDev that I didn't see this discussion until after I had already worked on adding the relevant documentation, so I pushed the commit anyways. I can amend or reverse it out if that's the consensus. I would also add that getting JARs to work in Finder is not possible by just setting the |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Looking good so far, thanks for the PR (and the sponsorship)!
|
I ended up adding a blurb about confirming the symlink with |
It appears the way to fix the % sudo ln -sfn $(brew --prefix $OPENJDK)/libexec/$OPENJDK.jdk /Library/Java/JavaVirtualMachines/ |
|
I'm not sure if that would work. Java is kinda finicky about it's paths. Could you test it and make a pull request if it does? |
Not sure that what would work? A symlink with It works fine: % pwd
/Library/Java/JavaVirtualMachines
% ls
jdk-14.0.2.jdk jdk-15.0.2.jdk jdk1.8.0_20.jdk openjdk.jdk
% /usr/libexec/java_home -V
Matching Java Virtual Machines (5):
15.0.2 (x86_64) "Oracle Corporation" - "Java SE 15.0.2" /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home
15.0.1 (x86_64) "UNDEFINED" - "OpenJDK 15.0.1" /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
14.0.2 (x86_64) "Oracle Corporation" - "Java SE 14.0.2" /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home
1.8.271.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_20 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home
% sudo mv openjdk.jdk openjdk@stuff.jdk
% /usr/libexec/java_home -V
Matching Java Virtual Machines (5):
15.0.2 (x86_64) "Oracle Corporation" - "Java SE 15.0.2" /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home
15.0.1 (x86_64) "UNDEFINED" - "OpenJDK 15.0.1" /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
14.0.2 (x86_64) "Oracle Corporation" - "Java SE 14.0.2" /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home
1.8.271.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_20 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home |
We'll, Java after that. But if you tested this I guess it's fine. |
Makes sense, but will break existing symlinks when people It's doable but probably not worth the effort, when it's just for a slightly different looking |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks so much for your sponsorship and first contribution (and sorry for all the back and forth)! Without people like you submitting PRs we couldn't run this project. You rock, @md5!
Per the discussion at Homebrew/discussions#910, this PR adds a "Homebrew and Java" page that documents the use of
openjdkor versioned alternatives by Java-based packages, as well as the ability to bring your own JDK by means of theJAVA_HOMEenvironment variable.