
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
How to compile & run a Java program using Command Prompt?n
While many programming environments allow us to compile and run a program within the environment, we can also compile and run java programs using Command Prompt.
After successful installation of JDK in our system and set the path, we can able to compile and execute Java programs using the command prompt.
- Step 1 - Need to create a java program either in Notepad or other IDE.
- Step 2 - Need to save this java file in a folder with "Demo.java" and it can be saved in a folder.
- Step 3 - Need to compile this java file from the command prompt using JAVAC command.
- Step 4 - "Demo.java" file is successfully compiled with a generation of ".class" file.
- Step 5 - Need to execute this java file using JAVA command without ".java" extension.
- Step 6 - Able to see "Welcome to TutorialsPoint" output in the console.
Example
class Demo{ public static void main(String args[]){ System.out.println("Welcome to Tutorials Point"); } }
Output
Welcome to TutorialsPoint
- Related Articles
- How to run a JAR file through command prompt in java?
- How to run a PowerShell script from the command prompt?
- How to run PowerShell commands from the command prompt?
- How to compile and run the C++ program?
- Java Program to open the Command Prompt and Insert commands
- How to compile a java program
- How to install a windows service using windows command prompt in C#?
- How to run a java program
- How to run MongoDB shell using mongos command?\n
- How to run a command inside Docker Container?
- How to run Java package program
- Getting MySQL path in command prompt
- How to Run a Command Multiple Times in Linux?
- How to run TestNG from command line?
- How to Edit, Compile, and Execute a C++ Program?

Advertisements