- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to run a java program
Compiling and running a java program is very easy after JDK installation. Following are the steps −
Open a command prompt window and go to the directory where you saved the java program (MyFirstJavaProgram.java). Assume it's C:\.
Type 'javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).
Now, type ' java MyFirstJavaProgram ' to run your program.
You will be able to see the result printed on the window.
- Related Articles
- How to run Java package program
- How to compile & run a Java program using Command Prompt?\n
- Java Program to Run Multiple Threads
- How to Run a Python Program
- How to run Perl Program?
- How to run Python Program?
- How to run JavaTuples program in Eclipse?
- How to compile and run the C++ program?
- How to run a JAR file through command prompt in java?
- How do I run a Python program under Windows?
- Run a Python program from PHP
- Can we synchronize a run() method in Java?
- Run a Java Application as a Service on Linux
- How to compile a java program
- How to run a command inside Docker Container?

Advertisements