Homebrew won’t say much, java8 won’t say much. There are too many examples of brew not installing java8. The final approach is to install the OpenJDK version, or install another version, or go to the official website to install.
I need to put on a hard outfit today! Hard install the official version of java8 with brew!
Installation error reported
brew cask install homebrew/cask-versions/java8
Copy the code
Execute this, and then definitely report an error
Error: Cask 'java8' is unavailable: '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions/Casks/java8.rb' does not exist.
Copy the code
That’s this thing right here
Add java8.rb
There is no java8.rb file in your folder
Let’s open up Github and delete java8.rb
Java8.rb content click a load diff
Copy the contents, create java8.rb at the address reported in the first step, and add
In case you can’t open Github, let me copy it here
cask 'java8' do
version '8u202,b08:1961070e4c9b4e26a04e7f5a083f551e'
sha256 'b41367948cf99ca0b8d1571f116b7e3e322dd1ebdfd4d390e959164d75b97c20'
url "https://download.oracle.com/otn-pub/java/jdk/#{version.before_comma}-#{version.after_comma.before_colon}/#{version.afte r_colon}/jdk-#{version.before_comma}-macosx-x64.dmg",
cookies: {
'oraclelicense'= >'accept-securebackup-cookie',
}
name 'Oracle Java 8 Standard Edition Development Kit'
homepage 'https://www.oracle.com/technetwork/java/javase/overview/index.html'
depends_on macos: '>= :yosemite'
pkg 'JDK 8 Update 202.pkg'
uninstall pkgutil: "com.oracle.jdk#{version.before_comma}",
delete: [
'/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin'.'/Library/PreferencePanes/JavaControlPanel.prefPane',
]
zap trash: [
'~/Library/Application Support/Oracle/Java'.'~/Library/Application Support/com.oracle.java.JavaAppletPlugin.plist'.'~/Library/Application Support/com.oracle.javadeployment.plist',
]
caveats do
license 'https://www.oracle.com/technetwork/java/javase/terms/license/javase-license.html'
end
end
Copy the code
All right, at this point, we’re sure
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions/Casks/java8.rb
Copy the code
This file is available.
To 3.oracleDownload java8
Download what version needless to say, oneself register an account to finish next.
I like to use BREW, typing command line this kind of frills, easy to delete!
Modify java8.rb
How to provide download address manually
Here we change the parameter, the parameter in the issue is too old.
I’ll tell you where they came from
1.version
Version has three values
The first one is version copy and paste and we’re done
The second and third values, BXX: XXX
Once again at the same download location, F12/ right click to review the elements, click on the small blue circled arrow, and then click on the red boxed area to the left. The HTML tag on the right will pop up the corresponding address. The address that I’ve underlined in red is
bxx:xxx
2. sha256
Write the path to the DMG you just downloaded
openssl dgst -sha256 /xxx/jdk-xxx-macosx-x64.dmg
Copy the code
3.url
The elder brother in issue is starting a server.
Scroll down to see if you can delete java8.rb and use the local path without using the server
Yes, change the url to the local path you downloaded, preceded by the file://
For example,
url "file:///Users/xingwu/Documents/tmp/jdk-#{version.before_comma}-macosx-x64.dmg".Copy the code
4.pkg
Double click the DMG you downloaded and you will find the PKG name written inside
Yes, that’s right. Just change it to that
5. Ok, you are ready to install your java8 on brew
brew cask install homebrew/cask-versions/java8
Copy the code
Six. Test installation is successful
java -version
Copy the code
Obviously, I’m OJBK
I don’t drink coffee, buy me a red bull hahaha
Refer to the address
Github: Java8 can’t be downloaded