Ubuntu 提示sudo: java: command not found解决办法
ubuntu下运行sudo Java 时提示“sudo: java: command not found”。在网上找了,其中很多方法都提示要修改/etc/profile的配置,或是修改/etc/environment的配置。配置完sudo java就可以运行了,但是改完之后依然无效。
根据一个大神的指引,应该是修改/etc/sudoers这个文件,
sudo vim /etc/sudoers
显示内容如下:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/java/jdk1.8.0_131/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification
root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL # Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d
在Defaults secure_path 中添加Java的路径。
再次运行 sudo java 就可以使用了。
Ubuntu 提示sudo: java: command not found解决办法的更多相关文章
- sudo: java: command not found
背景:搭建了jumpserver,给开发划分了所有权限,但是开发那边账户不能执行java命令 报错:sudo: java: command not found 解决方法: 在用户管理权限配置sudoe ...
- Linux提示no crontab for root的解决办法
Linux提示no crontab for root的解决办法 安装crontab:yum install crontabs 说明:/sbin/service crond start //启动服务/s ...
- VMware下 Ubuntu 看不到共享文件夹之解决办法
VMware下 Ubuntu 看不到共享文件夹之解决办法 初学Linux,在VMWare 上装了Ubuntu10.04,主机端和虚拟机相互间的访问是必不可少的,途径有许多,其中vmware tool提 ...
- 升级10.11后使用CocoaPod出现-bash: pod: command not found 解决办法-备
升级10.11后,运行pod命令出现: -bash: pod: command not found 解决办法: sudo gem install -n /usr/local/bin cocoapods ...
- Asp.Net Core2.0获取客户IP地址,及解决发布到Ubuntu服务器获取不到正确IP解决办法
1.获取客户端IP地址实现方法(扩展类) using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ModelBinding; u ...
- Ubuntu不能使用passwd的--stdin的解决办法
转载请注明来源https://www.cnblogs.com/sogeisetsu/p/11397648.html Ubuntu不能使用passwd的--stdin的解决办法 可以使用chpasswd ...
- installshield制作的安装包卸载时提示重启动的原因以及解决办法
原文:installshield制作的安装包卸载时提示重启动的原因以及解决办法 有时候卸载installshield制作的安装包程序,卸载完会提示是否重启电脑以完成所有卸载,产生这个提示的常见原因有如 ...
- 【转】Asp.Net Core2.0获取客户IP地址,及解决发布到Ubuntu服务器获取不到正确IP解决办法
1.获取客户端IP地址实现方法(扩展类) using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ModelBinding; u ...
- pip install 提示代理连接失败原因及解决办法
# pip install 提示代理连接失败原因及解决办法 1. 错误提示 在公司电脑上安装Python的虚拟环境时输入命令: pip install virtualenv 系统提示以下异常信息: R ...
随机推荐
- Pstools使用
pstool的介绍 PsTools是Sysinternals Suite中一款排名靠前的一个安全管理工具套件.现在被微软收购.目前pstools中含有12款各式各样的小工具.如果将它们灵活的运用,将会 ...
- python网络爬虫(一):网络爬虫的定义
网络爬虫,即Web Spider,是一个很形象的名字. 把互联网比喻成一个蜘蛛网,那么Spider就是在网上爬来爬去的蜘蛛.网络蜘蛛是通过网页的链接地址来寻找网页的. 从网站某一个页面(通常是首页)开 ...
- Java并发指南8:AQS中的公平锁与非公平锁,Condtion
一行一行源码分析清楚 AbstractQueuedSynchronizer (二) 转自https://www.javadoop.com/post/AbstractQueuedSynchronizer ...
- spring中文参考指南
主要是4.x版本的 比较全面的:https://muyinchen.gitbooks.io/spring-framework-5-0-0-m3/content/3.5-bean/3.5.4-reque ...
- Mybatis generator配置
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...
- centos出现磁盘坏道,怎么检索和修复
故障现象,在/var/log/message这个目录中出现下面的error: [ [ [ [ [ [ [ [ [ [ dmesg的输出结果也是上面的error. 1.检测下坏道,将结果保存在bb.lo ...
- .IllegalArgumentException: Mapped Statements collection does not contain 异常一例【我】
更新代码后发现几乎所有的sql查询都报错,类似下面: java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: ne ...
- error C2086: “int WINGDIAPI”: 重定义
1>------ 已启动生成: 项目: OSG_3_1_osgViewer应用基础, 配置: Debug x64 ------1>cl : 命令行 warning D9002: 忽略未知选 ...
- 阶段5 3.微服务项目【学成在线】_day05 消息中间件RabbitMQ_6.RabbitMQ研究-入门程序-消费者
我们在consumer这个功能下进行代码的编写 首先是新建这个层级的包 创建入门程序的消费者 消费者也需要和mq建立通道.建立连接创建通道 在顶部都声明这个队列 下面写核心代码监听队列.basicCo ...
- Salesforce LWC学习(九) Quick Action in LWC
我们在lightning开发中,quick action是一个常用的功能,很可惜的是,lwc目前还不支持单独的custom quick action操作,只能嵌套在aura中使用才能发挥作用. 官方也 ...