Question: How to Run Java Program in Windows 10?
Contents

Command Prompt

  • Open a Command Prompt window as administrator. Windows 10: press Win⊞ + S, type cmd, then press Ctrl + Shift + Enter. Or click Start, and click All Programs.
  • Enter the command setx JAVA_HOME -m “Path” . For “Path”, paste in your Java installation path .

Can you run Java on Windows 10?

So if you want to use Java on Windows 10, then you can download it from any browser and run on your system. Installation Process: Now run the Java using the Command prompt. Run command prompt and type Java-version and click the enter button.

How do I run a Java program?

1 Answer

  1. Open a command prompt window and go to the directory where you saved the java program (MyFirstJavaProgram.java).
  2. Type ‘javac MyFirstJavaProgram.java’ and press enter to compile your code.
  3. Now, type ‘ java MyFirstJavaProgram ‘ to run your program.
  4. You will be able to see the result printed on the window.
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest