【问题标题】:I installed JDK and added path variable but still i am facing -> zsh : command not found: jdk in macOS我安装了 JDK 并添加了路径变量,但我仍然面临 -> zsh : command not found: jdk in macOS
【发布时间】:2020-08-21 10:59:29
【问题描述】:

enter image description here

我尝试提供此路径变量,但似乎不起作用

export $JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.8.jdk/Contents/Home

然后我尝试了这个,似乎可以工作

export JAVA_HOME=$(/usr/libexec/java_home)

但仍然面临找不到 jdk 命令的问题

基本上,我正在尝试使用 chromedriver 安装

sudo apt install chromium-chromedriver

但我遇到了这个错误

【问题讨论】:

  • 没有jdk 命令。也许你的意思是java?
  • @Bhumika 为什么/如何在 MacOS 上使用 apt?
  • 这是一个经典的 X/Y 问题 (xyproblem.info)。你应该描述你面临的根本原因,而不是你认为你面临的问题。在下面的评论中,您给出的实际错误是尝试使用 apt 安装某些东西时。 apt 不是 MacOS 命令!你得到的错误是一个红鲱鱼。改用brew cask install chromedriver 安装chromedriver
  • @AlastairMcCormack 我是。抱歉,我认为 JDK 是导致安装 chrome 驱动程序(更新版本)的问题。我是 mac 的新手,我安装了 firefox 驱动程序,但它没有刮掉几页,因为加载需要时间,所以我在我的 selenium python 代码(scrappy-project)driver.execute_script("return document.readyState==\"complete\";") 中添加了 javascript,但它仍然没有加载一些页面需要时间。
  • (继续...)所以我在 StackOverflow 的某个地方看到使用 chrome 驱动程序(无头),因为它更快。我也已经安装了brew cask install chromedriver,但现在我遇到了这个错误raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chrome driver所以我一直在尝试用apt安装JDK

标签: java selenium selenium-chromedriver macos-catalina


【解决方案1】:

jdk 不是命令。您可能需要的基本命令是 javac 来编译您的代码和 java 来运行它。

【讨论】:

  • 我正在尝试使用 sudo apt install chromium-chromedriver 安装 chrome 驱动程序,但我面临这个错误 Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.8.jdk/Contents/Home/bin/apt" (-1) 我面临这个错误,但这是正确的路径
猜你喜欢
  • 2022-06-23
  • 1970-01-01
  • 2017-03-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-04-25
相关资源
最近更新 更多