I've got the same problem as the user who posted this question. I am trying to run a Java file on a Windows machine using Command Prompt, but I'm having no success using any of the information I've gleaned from the linked question, nor from WikiHow, nor from this user on another site with the same problem.
Here are the steps I've taken.
I've created a Java file using Notepad, called
HelloWorld.java
, and saved it in a folder called "Java". The file directory isC:\Users\[myname]\Google Drive\Java
. The code in the file is a simple Hello World as below:class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
I've downloaded Java version 8, and the latest version of the Java JDK (14.0.1) from the website. I previously had the JDK 12.x.x installed, so I uninstalled that.
I've opened System Properties > Advanced > Environment Variables, gone to the "Path" variable in "System variables", clicked "Edit" and added a new environment variable, which was the path to the JDK bin:
C:\Program Files\Java\jdk-14.0.1\bin
. I then clicked "Move Up" until this variable was at the top.After clicking OK and closing this window, I've opened Command Prompt, typed
set path=C:\Users\[myname]\Google Drive\Java
in order to (I imagine) set the path to where myHelloWorld.java
file is. I've typed inpath
to confirm that this has worked.I've typed in Command Prompt
javac HelloWorld.java
. When I hit Enter, I get the output:'javac' is not recognized as an internal or external command, operable program or batch file.
I'm honestly not sure what steps are left to take. Is there a simple fix to get this file to run?