‘javac’ is not recognized as an internal or external command, operable program or batch file

Total
0
Shares

Java throws the error, ‘javac’ is not recognized as an internal or external command, operable program or batch file, if the path of JDK is not set in environment variable.

According to Java documentation

Note: The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.

You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.

To add JDK path to the environment variable, follow these instructions –

Check where JDK is installed in your system. The default location is –

C:\Program Files\Java\jdk-{version}

Note: There are 2 things – JDK and JRE. javac is the part of JDK and not JRE. If you do not find a directory with name jdk in your Java installation path, then it means JDK is not installed correctly. You need to run installation again.

  • Open Control Panel > System
  • Click on Advanced > Environment Variables
  • Add bin location (C:\Program Files\Java\jdk-15\bin) to the PATH variable.

Or, if you do not want to add path variable, you can still use javac using full path –

C:\> "C:\Program Files\Java\jdk-15\bin\javac" MyClass.java

    Tweet this to help others

This will solve your error of, javac not recognized as internal/external command.

Sign Up for Our Newsletters

Get only the best articles delivered to your mail

You May Also Like

How to clear Java cache?

Table of Contents Hide Open Java control panelClear Java CacheRelated Posts: You should know how to clear java cache because temporary java files can impact the browser’s performance as well…
View Post

How to end program in Java?

In order to know how to end program in Java, you should be aware that calling return with in a function doesn’t end it. You need to use System.exit(0) command…
View Post

How to compare chars in Java?

Table of Contents Hide Compare chars, if defined using char datatypeIf defined using Character classMerged Code ExampleLive DemoRelated Posts: If you are wondering how to compare chars in java, then…
View Post

java.lang.NullPointerException

Java throws the exception java.lang.NullPointerException, when you declare an object but do not instantiate it and yet use it for calling a class method or setting / getting variables. Consider…
View Post
break text file into columns java

Break text file into columns Java

Table of Contents Hide IntroductionGetting StartedUsing String.split()Using StringTokenizerUsing Pattern.compile ()Code ExampleResultsLive DemoRelated Posts: Introduction To break text file into columns in Java you can use the split() method. There are…
View Post