Javac file not found error
C:\Users>javac HelloWorld.java
error: file not found: HelloWorld.java
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.
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.
- Setting up Java Home: https://code2care.org/pages/setting-java_home-environment-variable-on-windows-operating-system
Comments:
- 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!
More Posts related to Java,
- Java equals method - Tutorial
- Unbound classpath container: JRE System Library [JavaSE-1.7]
- Spring Boot: @RequestBody not applicable to method
- Java 8: Steam map with Code Examples
- Java Program: Random Number Generator
- Java java.time.Clock class code examples [Java Date Time API]
- Fix: type argument is not within bounds of type-variable T
- [Fix] java.net.MalformedURLException: unknown protocol
- Java 7 addSuppression() and getSuppression() Exception Handling
- Convert Java Array to ArrayList Code Example
- How to Word-Warp Console logs in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Remove Trailing zeros BigDecimal Java
- CRUD operations in Spring Boot + JDBC
- [Java Threads] Should we extend Thread Class or implement Runnable interface
- Json Serialization and Deserialization using Java Jackson
- Create simple struts2 project using maven commands
- How to install Java OpenJDK 11 on Alpine Linux
- Unsupported major.minor version 52.0 in java
- Error: Can not find the tag library descriptor for
- Java: Convert String to Binary
- How to run Java Unit Test cases with Apache Maven?
- Java: Testing Private Methods in JUnit using reflection API Example
- Java JDBC Connection with MySQL Driver in VS Code + Troubleshooting
- Java Join Strings with Comma Separator
More Posts:
- Android Lint app_name is not translated in af (Afrikaans) am (Amharic) ar (Arabic) bg (Bulgarian) - Android
- Unzip a Zip file from Terminal Command - HowTos
- How to update Android Studio - Android-Studio
- [Fix] TypeError: str object is not callable in Python - Python
- How to find the path of formula Installation by Brew - HowTos
- Get the Size of HTTP Response using cURL Command (Content Length) - cURL
- How to fix Microsoft Windows 10 update error 80070020 - Microsoft
- Open New Terminal Window Using Keyboard Shortcut macOS - MacOS