无法使用Maven命令行工具。

huangapple go评论60阅读模式
英文:

Can't use maven command-line tool

问题

以下是您在终端中使用Maven时收到的消息的翻译:

JAVA_HOME环境变量未正确定义,
需要定义此环境变量才能运行该程序。

这是JAVA_HOME环境变量的定义:

echo $JAVA_HOME
/usr/lib/jvm/default-runtime/bin/java

java --version
openjdk 19.0.2 2023-01-17
OpenJDK Runtime Environment (build 19.0.2+7)
OpenJDK 64-Bit Server VM (build 19.0.2+7, mixed mode)
英文:

Here is the message I get when I try to use maven in the terminal:

The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.

This is the definition of the JAVA_HOME environment variable:

echo $JAVA_HOME                                                                                1 ✘ 
/usr/lib/jvm/default-runtime/bin/java

java --version                                                                                   ✔ 
openjdk 19.0.2 2023-01-17
OpenJDK Runtime Environment (build 19.0.2+7)
OpenJDK 64-Bit Server VM (build 19.0.2+7, mixed mode)

答案1

得分: 3

看起来你将 JAVA_HOME 设置为指向 java 可执行文件,而不是应该指向包含 Java 安装的目录。应该是

export JAVA_HOME=/usr/lib/jvm/default-runtime
英文:

It looks like you set JAVA_HOME to point to the java executable, not the directory containing the Java installation, as it should be

export JAVA_HOME=/usr/lib/jvm/default-runtime

huangapple
  • 本文由 发表于 2023年5月14日 18:48:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76247056.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定