- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to resolve javac is not recognized as an internal or external command in java?
When you compile a program if you see this error it indicates that either you have not installed Java in your system properly or, you haven’t set the Path variable.
The Path variable − The path environment variable is used to specify the set of directories which contains executional programs.
When you try to execute a program from command line, the operating system searches for the specified program in the current directly, if available, executes it.
In case the programs are not available in the current directory, operating system verifies in the set of directories specified in the ‘PATH’ environment variable.
Setting Up the Path for Windows
Assuming you have installed Java in c:\Program Files\java\jdk directory −
- Right-click on 'My Computer' and select 'Properties'.
- Click the 'Environment variables' button under the 'Advanced' tab.
- Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.>
Setting Up the Path for Linux, UNIX, Solaris, FreeBSD
Environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your shell documentation, if you have trouble doing this.
Example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export PATH = /path/to/java:$PATH'
- Related Articles
- How to resolve "Could not find or load main class package" in Java?
- Internal and External Prejudice
- How to Check if an Array is Empty or Not in Java
- How to get/resolve the command from the alias in PowerShell?
- What is the difference between javac, java commands?
- How to resolve - Relative path is not supported in PowerShell DSC?
- How to get free size of internal/external memory in Android App?
- How to resolve a NullPointerException in Java?
- How to check if an URL is valid or not using Java?
- Difference Between Internal and External fragmentation
- Difference between Internal and External Modem
- What is the difference between external and internal fertilization?
- How To Check Whether a Number is an Ugly Number or Not in Java?
- How To Check Whether a Number is an Empire Number or Not in Java?
- Understanding Internal and External Forwarding Rules in GCP