How to Run Java Code in CMD

How to Run Java Code in CMD

Steps to Run Java in Command Prompt:-

1. Wite your Java code and Save it with ".java" extension.
2. Go to your folder in which your file is present. Type the following commands in CMD. 👇

 javac classname.java  - To Complile Source Code written in Java.
 java classname  - To Run the Bytecode which is also called .class file.


Points to Remember:-

  • Class name and File name must be exact same. It is case-sensitive.
  • Always Save the File with class name which contains main method.


#JavaCMDExecution #RunJavaCode #CMDJavaCompilation #JavaProgrammingTips

Post a Comment

0 Comments