[英]Linux- javac Command Not Found
I use puTTy to connect to a remote server running Linux.我使用 PuTTy 连接到运行 Linux 的远程服务器。 When I run当我跑步时
abc@myName((/home/myName)$java -version
I get the following我得到以下
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
Then I used readlink -f $(which java)
to find the location of the java command and I got the location as /opt/jdk1.7.0_80/bin/java
.然后我使用readlink -f $(which java)
找到 java 命令的位置,我得到的位置是/opt/jdk1.7.0_80/bin/java
。
Now I navigated to this location and listed the files现在我导航到这个位置并列出了文件
abc@myName(/opt/jdk1.7.0_80/bin)$ls
appletviewer idlj javac javap jconsole jinfo jps jstat native2ascii rmic serialver wsgen
apt jar javadoc java-rmi.cgi jcontrol jmap jrunscript jstatd orbd rmid servertool wsimport
ControlPanel jarsigner javafxpackager javaws jdb jmc jsadebugd jvisualvm pack200 rmiregistry tnameserv xjc
extcheck java javah jcmd jhat jmc.ini jstack keytool policytool schemagen unpack200
Then I tried the following然后我尝试了以下
abc@myName(/opt/jdk1.7.0_80/bin)$javac
And got并得到
-bash: javac: command not found
Could someone help me with this?有人可以帮我吗?
The JDK folder you specified is not in your PATH.您指定的 JDK 文件夹不在您的 PATH 中。 The current directory is not in your PATH either.当前目录也不在您的 PATH 中。 Option 1.选项1。
cd /opt/jdk1.7.0_80/bin
./javac
That is using the local path.那就是使用本地路径。
Option 2.选项 2。
/opt/jdk1.7.0_80/bin/javac
That is using the full path.那就是使用完整路径。
Option 3.选项 3。
export PATH=$PATH:/opt/jdk1.7.0_80/bin
javac
That is adding the folder to your PATH.那就是将文件夹添加到您的 PATH 中。
In terminal, type the command javac -version
在终端中,键入命令javac -version
Does it yield the following message?它会产生以下消息吗?
The command «javac» was not found, but it can be installed with: apt install default-jdk apt install openjdk-11-jdk-headless apt install ecj apt install openjdk-8-jdk-headless
If so, use apt install default-jdk
and javac will be working again.如果是这样,请使用apt install default-jdk
并且 javac 将再次工作。
This is a $PATH issue.这是一个 $PATH 问题。 $PATH is an environment variable that contains a list of directories to search when looking for an executable $PATH 是一个环境变量,其中包含查找可执行文件时要搜索的目录列表
Try to exceute this command:尝试执行此命令:
export PATH=/opt/jdk1.7.0_80/bin:$PATH导出 PATH=/opt/jdk1.7.0_80/bin:$PATH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.