无法使用自制软件安装 java8

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/55834845/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 01:14:00  来源:igfitidea点击:

Unable to install java8 with homebrew

javamacosjava-8homebrew

提问by dmitrybelyakov

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

java8使用 Homebrew安装似乎不再有效。运行后:

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 java8on MacOS nowadays?

这似乎是最近的发展,因为我记得几个月前以这种方式安装它。java8现在有什么关于如何在 MacOS上正确安装的建议吗?

采纳答案by Kiskae

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

这已经作为 github 问题得到了回答:https: //github.com/Homebrew/homebrew-cask-versions/issues/7253

TLDR: the java8artefact 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.

TLDR:java8人工制品是指已停止支持/可用的 Oracle 发行版。如果您确实需要 java 1.8 而不是最新版本,您可以查看AdoptOpenJDK/homebrew-openjdk.

回答by Pukhraj soni

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

Java8 在 Homebrew 上不再可用。改用以下命令:

brew cask install adoptopenjdk/openjdk/adoptopenjdk8

brew cask install adoptopenjdk/openjdk/adoptopenjdk8

回答by Corey Pett

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

命令是现在 brew cask install homebrew/cask-versions/adoptopenjdk8

回答by Vasyl Petrov

The command is

命令是

 brew cask install adoptopenjdk8-openj9

Fixed my problem and I can run my project in java8

修复了我的问题,我可以在 java8 中运行我的项目

java -version

版本

openjdk version "1.8.0_222

openjdk 版本“1.8.0_222

OpenJDK Runtime Environment (build 1.8.0_222-b10)

OpenJDK 运行时环境(构建 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)

Eclipse OpenJ9 VM(构建 openj9-0.15.1、JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20190717_298(启用 JIT,启用 AOT)

OpenJ9 - 0f66c6431

OpenJ9 - 0f66c6431

OMR - ec782f26

OMR - ec782f26

JCL - f147086df1 based on jdk8u222-b10)

JCL - f147086df1 基于 jdk8u222-b10)

回答by Lyncean Patel

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

虽然 cask 取消了对 JAVA8 的支持,但我们仍然可以使用 brew 安装 JAVA8。

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

需要手动下载JAVA8.dmg,添加cask可以使用的java8.rb。

Machine: MAC

机器:MAC

OS: Mojave (10.14.6)

操作系统:莫哈韦沙漠 (10.14.6)

JAVA version: java 8u231

JAVA 版本:java 8u231

Step-1

第1步

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

Oracle 站点下载 dmg 文件。您需要 oracle 帐户才能下载相同的

Step-2

第2步

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

从下载 dmg 文件的文件夹启动 HTTP 服务器。对我来说~/Downlaods,我使用 python 来启动 HTTP 服务器:

python -m SimpleHTTPServer 8000

python -m SimpleHTTPServer 8000

Step-3

步骤 3

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

java8.rb/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks(存在 java.rb 的地方)创建文件并添加以下内容:

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 安装:

brew cask install java8

brew cask install java8

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

注意:我从上面提到的 java 下载链接中获得了 SHA-256 校验和。

回答by Jane.Abraham

Ask the user to install Oracle JDK 8 instead of java8

要求用户安装 Oracle JDK 8 而不是 java8

回答by Poonkodi

The command is:

命令是:

  brew cask install adoptopenjdk/openjdk/adoptopenjdk8