如何获得我正在使用的命令的完整path?
例如,我已经安装了jdk到/opt/Oracle/jdk1.7.0_25 ,我的PATH如下所示:
/opt/Oracle/jdk1.7.0_25/bin/:/usr/lib/x86_64-linux-gnu/qt4/bin:/home/unimous/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games.
我想从java获取/opt/Oracle/jdk1.7.0_25/bin/java 。
比较两个文本文件相互
在Linux中刚性设置JAVA_HOMEvariables
Linux:系统调用改变了吗?
git的“make”中有哪些文件需要运行git?
在Java中有什么办法共享内存位置来交换一些实时的小包?
(C,Linux)知道networking接口是无线还是有线
使用Linux访问并行端口
运行aws cli时Pyexpat导入错误
which java
应该给你完整的路径。
这也适用于Linux中的任何其他命令,只要使用which command_name 。
这取决于你的分布,在debian和基于debian的发行版中你有更新的选择
而对于你的Java你做例如:
update-alternatives –install“/ usr / bin / java”“java”“/opt/Oracle/jdk1.7.0_25/bin/java”3
Help section on update-alternatives update-alternatives: --install needs <link> <name> <path> <priority> Usage: update-alternatives [<option> ...] <command> Commands: --install <link> <name> <path> <priority> [--slave <link> <name> <path>] ... add a group of alternatives to the system. --remove <name> <path> remove <path> from the <name> group alternative. --remove-all <name> remove <name> group from the alternatives system. --auto <name> switch the master link <name> to automatic mode. --display <name> display @R_941_4045@ion about the <name> group. --query <name> machine parseable version of --display <name>. --list <name> display all targets of the <name> group. --get-selections list master alternative names and their status. --set-selections read alternative status from standard input. --config <name> show alternatives for the <name> group and ask the user to select which one to use. --set <name> <path> set <path> as alternative for <name>. --all call --config on all alternatives. <link> is the symlink pointing to /etc/alternatives/<name>. (eg /usr/bin/pager) <name> is the master name for this link group. (eg pager) <path> is the location of one of the alternative target files. (eg /usr/bin/less) <priority> is an integer; options with higher numbers have higher priority in automatic mode. Options: --altdir <directory> change the alternatives directory. --admindir <directory> change the administrative directory. --log <file> change the log file. --force allow replacing files with alternative links. --skip-auto skip prompt for alternatives correctly configured in automatic mode (relevant for --config only) --verbose verbose operation,more output. --quiet quiet operation,minimal output. --help show this help message. --version show the version.
如果你在bash中:
type java
$ type type type is a shell builtin $ type which which is hashed (/usr/bin/which)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。