It looks like the javac executable cannot be found because you did not set your PATH environment variable to include it. This is a simple fix. This is a simple fix. Since you are clearly using Windows XP. If not found javac.exe file, need to install the java properly on windows 10 machine. If javac.exe file is found then try to configure java jdk bin location directory path in environment path variable to use javac command in any path directory. I need javac so I came to know that this is available only if I install JDK. So I installed JDK by executing the following command yum install java-1.7.0-openjdk-devel.
This tutorial shows you how to set a JAVA_HOME
system variable on Windows 10.
Tested with :
- Windows 10
- JDK 1.8
1. Advanced System Settings
Type advanced system settings
in the search box (beside the Windows start button), clicks View advanced system settings
.
2. Environment Variables
Select Advance
tab, clicks Environment Variables
3. Add JAVA_HOME
In System variables, clicks New...
button to add a new JAVA_HOME
variable and point it to the JDK installed folder.
Don’t include the
bin
folder, just the JDK path. For example- Correct – C:Program FilesJavajdk1.8.0_60
- Wrong – C:Program FilesJavajdk1.8.0_60bin
4. Update PATH
In System variables, find PATH
, clicks edit...
button :
4.1 In old version of Windows, it will prompt you below dialog box to edit the values directly, append this %JAVA_HOME%bin;
to the end of the line.
4.2 In latest Windows 10, it will prompt you below dialog box, clicks on New
button, and add this %JAVA_HOME%bin
Javac Command Not Found Windows
Puts the
%JAVA_HOME%bin
in PATH
make all the Java’s commands (java, javac, jstack and etc) are accessible from everywhere.5. Test
Open a command prompt, type :
References
About the Author
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.Comments
I have CentOS 6.7. I have installed Java 1.8. When I do Java -version I see the following output.
java version '1.8.0_121'
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
I need javac so I came to know that this is available only if I install JDK. So I installed JDK by executing the following command
yum install java-1.7.0-openjdk-devel
The installation was successful. But now when I again execute the command java -version, I see the old result. If I try to execute javac at the command prompt I see the error '-bash: javac: command not found'. I observed that OpenJDK was installed to the directory /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin. So, I set it to JAVA_HOME, but I still cannot execute javac command. What am I doing wrong here?
Jeff Schaller♦1 Answer
I have fixed this issue by executing the following command. I was not setting the PATH variable properly. I executed the following two commands and my problem was fixed.