- 1

Java file not found in cmd [SOLVED]

Hi friends 🖐🏼 I'm beginner in Java and I installed JDK in win 10. I changed path and JAVA_HOME but when I open cmd and type javac hello.java it shows "file not found". How can I fix this problem?

16th Aug 2021, 5:14 PM
Shakiba Majd
Shakiba Majd - avatar
15 Answers
+ 5
if it shows file not found instead of command not recogonized then probably java is installed correctly but trying in wrong directory
16th Aug 2021, 6:26 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 4
Shakiba Majd please attach anykinda screenshot or the exact message that you are getting so that we could get an idea of whats actually goin on with it
16th Aug 2021, 6:58 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 4
Shakiba Majd probably you have opened your command prompt in wrong place .. just do as follows.. open file explorer and go to the directory in which your file "hello.java" contains .. affer that in the address bar type cmd this will open command prompt in that directory after that try compiling ... leme see if that works.. please provide a screenshot if that doesn't work too...
17th Aug 2021, 4:38 AM
Prashanth Kumar
Prashanth Kumar - avatar
+ 4
Martin Taylor Prashanth Kumar Quantum A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ Sakshi Agrawal Thanks a lot 🙏 It's ok now with your help, cmd has wrong location.
17th Aug 2021, 10:28 AM
Shakiba Majd
Shakiba Majd - avatar
+ 3
Maybe java is not completely installed. You should try to delete the java that is installed on your device, and try to reinstall it. Let the installation gets complete then try to run your code.
17th Aug 2021, 8:24 AM
Sakshi Agrawal
Sakshi Agrawal - avatar
+ 1
You have to enter the full current path of the file. javac full_current_path/hello.java
16th Aug 2021, 5:37 PM
Jan
Jan - avatar
+ 1
Shakiba Majd What I meant was: "FULL_CURRENT_PATH"
16th Aug 2021, 8:08 PM
Jan
Jan - avatar
+ 1
Shakiba Majd Your Java file name and Class name should be same
16th Aug 2021, 8:14 PM
A͢J
A͢J - avatar
+ 1
Shakiba Majd Open Environment Variable Select path Add your JDK path and this path should be like C://Program Files//java/bin Then try to compile and run Java class
16th Aug 2021, 8:25 PM
A͢J
A͢J - avatar
0
Quantum What does "hole_path" mean?
16th Aug 2021, 6:13 PM
Shakiba Majd
Shakiba Majd - avatar
0
Prashanth Kumar Thanks and how can I fix it?
16th Aug 2021, 6:28 PM
Shakiba Majd
Shakiba Majd - avatar
0
Prashanth Kumar I get this message: error: file not found: Hello.java ‌Usage: javac <options> <source files> ‌use --help for a list of possible options
16th Aug 2021, 8:09 PM
Shakiba Majd
Shakiba Majd - avatar
0
Quantum I'll try it,thank you🙏
16th Aug 2021, 8:13 PM
Shakiba Majd
Shakiba Majd - avatar
16th Aug 2021, 8:16 PM
Shakiba Majd
Shakiba Majd - avatar
0
Hello friends I am. Beginner my error : file not found :java code
17th Jan 2023, 1:06 AM
Hema Almora
Hema Almora - avatar