error: file not found:

Javac file not found error
Javac file not found error
error: file not found:
Usage: javac <options> <source files>
use --help for a list of possible options

Are you trying to run your first Java program via Windows Command Prompt or macOS Terminal and unable to run because of the above error, there are few things that can go wrong,

  • Do you have file available at the location where you are running the javac command. If the file is not found you can get this error. Do dir and check if the file is available in this location.
  • Make sure that the file extension is provided correctly i.e. .java
  • Also be sure the name the file specified matches with the case in the command (case-sesitivity).
  • Make sure the location where you are running this file has permissions.
Code Sample:
public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World!");


If you are able to find the javac command that indicates that your JAVA_HOME is set properly, it's just the file is not accessible.


  • I am learning Java and got this particular error while doing my practice, helped, thanks!
    anon 08 Nov 2020 18:11:04 GMT
  • Further comments disabled!
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap