Unable to install java8 with homebrew

白昼怎懂夜的黑 提交于 2020-05-24 17:10:46

问题


Installing java8 with Homebrew seems to no longer be working. After running:

brew install caskroom/cask/java8

I get the following error:

Error: Cask 'java8' is unavailable: '/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask/Casks/java8.rb' does not exist.

Simply doing:

brew cask install java8

Errors out with:

Error: Cask 'java8' is unavailable: No Cask with this name exists.

This seems like a recent development because I remember installing it this way a few months ago. Any suggestions on how to properly install java8 on MacOS nowadays?


回答1:


This has already been answered as a github issue: https://github.com/Homebrew/homebrew-cask-versions/issues/7253

TLDR: the java8 artefact refers to the Oracle distribution, which has ceased being supported/available. If you really need java 1.8 instead of the latest versions you can take a look at AdoptOpenJDK/homebrew-openjdk.




回答2:


Java8 is no longer available on Homebrew. Use below command instead :

brew cask install adoptopenjdk/openjdk/adoptopenjdk8




回答3:


The command is now brew cask install homebrew/cask-versions/adoptopenjdk8




回答4:


The command is:

  brew cask install adoptopenjdk/openjdk/adoptopenjdk8



回答5:


The command is

 brew cask install adoptopenjdk8-openj9

Fixed my problem and I can run my project in java8

java -version

openjdk version "1.8.0_222

OpenJDK Runtime Environment (build 1.8.0_222-b10)

Eclipse OpenJ9 VM (build openj9-0.15.1, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20190717_298 (JIT enabled, AOT enabled)

OpenJ9 - 0f66c6431

OMR - ec782f26

JCL - f147086df1 based on jdk8u222-b10)




回答6:


Although cask remove the support for JAVA8, we can still install JAVA8 using brew.

It requires the manual download of JAVA8.dmg and add the java8.rb which could be used by cask.

Machine: MAC

OS: Mojave (10.14.6)

JAVA version: java 8u231

Step-1

Download dmg file from Oracle Site. You require oracle account to download the same

Step-2

Start the HTTP server from the folder where you downloaded the dmg file. For me it's ~/Downlaods and I use python to start HTTP server:

python -m SimpleHTTPServer 8000

Step-3

Create file java8.rb in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks (where java.rb exist) and add the following:

cask 'java8' do
  version '8u231,b15:9eef341qase34d44fbaa21'
  sha256 'f808d11b34fa9ee7b6326b5b6dd18544496e02c84b839d94e062bd4493df5d45'

  url "http://localhost:8000/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 231.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


Step-4

Now, install using brew:

brew cask install java8

Note: I got the SHA-256 checksum from the above mentioned java download link.




回答7:


Ask the user to install Oracle JDK 8 instead of java8



来源:https://stackoverflow.com/questions/55834845/unable-to-install-java8-with-homebrew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!