Search code examples
javacompilationcommandprompt

Java Environment Variables


So I'm setting everything up to compile java on my Windows 10 computer, and when I went to the environment variables there was no existing PATH, so I added one. When I type "javac" in the command prompt it is able to recognize it, but when I try to save a java file (on notepad as a test) and try to put that in the command prompt I get the "is not recognized as an internal or external command, operable program or batch file." Everything I've looked up about this response refers back to the environmental variables, but I can't figure out what I did wrong. My PATH looks like this: C:\Program Files\Java\jdk1.8.0_77\bin. Am I missing something obvious?


Solution

  • Environment Variables

    Here you need to set two variables in the " Environment Variables " for executing Java files. In the image you can see first variable(Java_Home) is defining the path of jdk in the system and the second variable is defining the path where the Java executables(javac.exe, java.exe, javadoc.exe, and so on) reside. Do it like that your problem will be solved....