You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 20.04安装Gradle 7.2后开机出现gradle.sh权限被拒绝报错

Ubuntu 20.04 安装Gradle 7.2开机权限报错解决方案

问题原因

你在配置过程中遗漏了给/etc/profile.d/gradle.sh添加可执行权限的步骤。/etc/profile.d/目录下的.sh后缀文件会在用户登录时被系统自动执行以加载全局环境变量,没有可执行权限的情况下就会触发如下报错:

Error found while loading /etc/profile:

/etc/profile.d/gradle.sh: Line 1: /etc/profile.d/gradle.sh: Permission denied

As a result the session will not be configured correctly.
You should fix the problem as soon as feasible.

修复步骤

  • 执行权限添加命令:sudo chmod +x /etc/profile.d/gradle.sh
  • 手动加载全局配置验证权限问题是否解决:source /etc/profile
  • 验证Gradle配置有效性:gradle -v,终端正常输出Gradle 7.2版本信息即修复完成,下次开机不会再弹出报错。

内容的提问来源于stack exchange,提问作者Aleksandar Trifunovic

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.02 20:36:04