"javac is not recognized as an internal or external command" error message that is appearing on your Windows or Linux machine?
The error message "javac is not recognized as an internal or external command" typically means that the Java compiler (javac) is not properly installed or configured on your system, or the system cannot find its location.
Here are some steps you can take to fix this issue in Windows:
Check if Java is installed: Open the Command Prompt and type "java -version" to see if Java is installed. If you see the version number, then Java is installed on your system. If not, you need to install Java.
Set the Path: If Java is installed, but you still get the error message, then you need to set the PATH environment variable.
To do this, follow these steps:
Open the Control Panel and search for "Environment Variables".
Click on "Edit the system environment variables".
Click on the "Environment Variables" button.
Under "System Variables", scroll down and select "Path", then click "Edit".
Add the path to the "bin" folder of your JDK installation. For example, if your JDK is installed in "C:\Program Files\Java\jdk-11.0.2", then add "C:\Program Files\Java\jdk-11.0.2\bin" to the PATH variable.
Restart your Command Prompt: After setting the PATH variable, you need to restart your Command Prompt for the changes to take effect.
For Linux, the steps are similar but the commands are different. Here are some steps to fix the issue in Linux:
Check if Java is installed: Open the terminal and type "java -version" to see if Java is installed. If not, you need to install Java.
Set the Path: If Java is installed, but you still get the error message, then you need to set the PATH environment variable. To do this, open your .bashrc file by typing "nano ~/.bashrc" in the terminal. Then add the following line at the end of the file:
export PATH=$PATH:/path/to/jdk/bin
Replace "/path/to/jdk/bin" with the actual path to the "bin" folder of your JDK installation.
Reload your bashrc: After setting the PATH variable, you need to reload your .bashrc file by typing "source ~/.bashrc" in the terminal.
This should fix the issue.Thanks..
Labels: best practices, core java, core java interview question
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
<< Home