If you need to compile a Java program with the Command Prompt, but it pops up the following error message:
‘javac’ is not recognized as an internal or external command, operable program or batch file.
Follow the steps below to solve the problem:
Firstly go to Computer, right click on an empty spot on the screen (sostituirei con window, anche nell’articolo originale) > Properties.
Secondly, in the left menu, click on “Advanced system settings”.
In the window that appears go to “Advanced” and then click on the button “Environment Variables…”.
Now in the scrolling window click on “Path” and then on the “Edit” button.
You will be faced with this window with a list of variables.
Choose the first at the top of the list:
Without closing anything, go to Computer > Local Disk (C:) > Programs > Java, and enter the folder with the latest version of JDK, as an example:
Then enter the “bin” folder.
Select the address in the top bar and copy it.
Now go back to the small window that you left previously opened, delete all the contents of “Variable Value:” and paste the address you just copied.
Finally click OK > OK > OK, close the window of the Windows’ informations and at this point you can go to run all the Java commands (such as ‘java’, ‘javac’, ‘javap’, …) from the Terminal.