Unable to install Maven on Windows: “JAVA_HOME is set to an invalid directory”

本文介绍了一种解决Maven更新时遇到的问题的方法。通过在mvn.bat文件中显式设置JAVA_HOME环境变量为具体路径(例如C:Program FilesJavajdk1.8.0_111),可以有效解决因环境变量配置不当导致的Maven无法正常使用的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


在使用maven更新的时候碰到这个问题,明明环境变量已经配置好了啊,默默的检查了几遍没问题

最后没办法,只有去mvn\bin下打开mvn.bat

在开始的时候添加@SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111

然后就可以使用了





SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/spark/spark-2.4.0-bin-hadoop2.7/jars/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/Hadoop/hadoop-2.7.2/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/hbase-1.2.6/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 25/03/21 15:56:07 WARN Utils: Your hostname, master resolves to a loopback address: 127.0.0.1; using 192.168.180.130 instead (on interface ens33) 25/03/21 15:56:07 WARN Utils: Set SPARK_LOCAL_IP if you need to bind to another address 25/03/21 15:56:08 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Setting default log level to "WARN". To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel). 25/03/21 15:56:09 WARN Utils: Service 'SparkUI' could not bind on port 4040. Attempting port 4041. 25/03/21 15:56:12 WARN FileStreamSink: Error while looking for metadata directory. Traceback (most recent call last): File "/home/abz/PycharmProjects/untitled1/2024.10.22.test.py", line 6, in <module> df = spark.read.csv("传媒综合.csv", header=True, inferSchema=True, sep="|", encoding='utf-8') File "/opt/spark/spark-2.4.0-bin-hadoop2.7/python/pyspark/sql/readwriter.py", line 472, in csv return self._df(self._jreader.csv(self._spark._sc._jvm.PythonUtils.toSeq(path))) File "/opt/spark/spark-2.4.0-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in __call__ File "/opt/spark/spark-2.4.0-bin-hadoop2.7/python/pyspark/sql/utils.py", line 63, in deco return f(*a, **kw) File "/opt/spark/spark-2.4.0-bin-hadoop2.7/python/lib/py4j-0
最新发布
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BlueGoDisplay

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值