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!
Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR -