• Send Us A Tip
  • Calling all Tech Writers
  • Advertise
Tuesday, June 16, 2026
  • Login
TechStory
  • News
  • Crypto
  • Gadgets
  • Memes
  • Gaming
  • Cars
  • AI
  • Startups
  • Markets
  • How to
No Result
View All Result
  • News
  • Crypto
  • Gadgets
  • Memes
  • Gaming
  • Cars
  • AI
  • Startups
  • Markets
  • How to
No Result
View All Result
TechStory
No Result
View All Result
Home How to

How to run Java program

by Srestha Roy
September 18, 2021
in How to
Reading Time: 3 mins read
0
How to run Java program
TwitterWhatsappLinkedin

Java is an object-oriented programming language with a high level of abstraction and as few implementation dependencies as feasible. It is a general-purpose programming language that allows application developers to write once and run anywhere, which means that generated Java code may run on any platform that supports Java without the need to recompile. Java programmes are usually compiled to bytecode, which may execute on any Java virtual machine (JVM), independent of the computer architecture. Java has a syntax that is comparable to C and C++, although it has less low-level features than any of these languages.

You might also like

How does Reddit make money?

How To Upgrade Crafted Weapons To Tier 5 In Destiny 2

How To Get Chronologs In Destiny 2

Traditional compiled languages lack dynamic capabilities like as reflection and runtime code change, which are accessible in the Java runtime. According to GitHub, as of 2019, Java was one of the most popular programming languages in use, especially for client-server web applications, having 9 million developers.

Simple Java Program

public class FirstJavaProgram {
  public static void main(String[] args){
    System.out.println("This is my first program in java");
  }//End of main
}//End of FirstJavaProgram Class

How can I compile and run the programme above?

Prerequisite: Java must be installed on your computer. Here’s where you can obtain the Java.
Step 1: Open a text editor on your computer, such as Notepad for Windows or TextEdit for Mac. Copy and paste the above programme into a text editor.
Step 2: Name the file FirstJavaProgram.java and save it. You might be asking why we called the file FirstJavaProgram; the reason is that the file should always be named the same as the public class name.
Step 3: In this step, we will compile the programme. To do this, open command prompt (cmd) on Windows, or Terminal on Mac OS.

Type the following command and click enter to compile the programme.

javac FirstJavaProgram.java

Set Path in Windows:

Open the command prompt (cmd), navigate to the location where you installed Java on your machine, and find the bin directory. Copy the whole path and paste it into the command like this.

set path=C:Program FilesJavajdk1.8.0_121bin

When attempting to compile the programme, you may receive the following error: “javac’ is not recognised as an internal or external command, operable programme, or batch file“. When your system’s java path isn’t configured, you’ll get this error.

Set Path in Mac OS X

To use Terminal, open it and type the following command followed by the return key.

export JAVA_HOME=/Library/Java/Home

To confirm the path, run the following command on the terminal.

echo $JAVA_HOME

The instructions above are for temporarily setting up the route, which means the path settings will be lost when you exit the command prompt or terminal, and you will have to establish the path again the next time you use it. In the next tutorial, I’ll show you how to set up a permanent route.

Step 4: The.java file is converted into a.class file after compilation (byte code). We may now start the programme. To start the application, type and click enter the following command:

java FirstJavaProgram
Tags: iosiPhoneJAVAMacprogram
Tweet54SendShare15
Previous Post

Meme stock AMC is now accepting crypto, but not Dogecoin

Next Post

How to activate Amazon Prime with Airtel

Srestha Roy

Recommended For You

How does Reddit make money?

by Afeefa Ansari
June 16, 2026
0
Reddit

Are you curious about how Reddit makes money? Here is all you need to know about it! Follow the guide to know how it happens and if you...

Read more

How To Upgrade Crafted Weapons To Tier 5 In Destiny 2

by Khilav Jadav
June 16, 2026
0
How to Get Harsh Language in Destiny 2

Crafted weapons have always been among the most valuable tools in Destiny 2. They allow players to choose their favorite perks and gradually improve their gear over time....

Read more

How To Get Chronologs In Destiny 2

by Khilav Jadav
June 16, 2026
0
How to Get the Ergo Sum in Destiny 2

Chronologs are a special currency in Destiny 2 that allows players to unlock rewards from previous seasons. Bungie introduced this system to help Guardians obtain cosmetics and other...

Read more
Next Post
How to activate Amazon Prime with Airtel

How to activate Amazon Prime with Airtel

Please login to join discussion

Techstory

Tech and Business News from around the world. Follow along for latest in the world of Tech, AI, Crypto, EVs, Business Personalities and more.
reach us at info@techstory.in

Advertise With Us

Reach out at - info@techstory.in

Aviator Game India 2026

BROWSE BY TAG

#Crypto #howto 2024 acquisition AI amazon Apple Artificial Intelligence bitcoin Business China cryptocurrency e-commerce electric vehicles Elon Musk Ethereum facebook funding Gaming Google India Instagram Investment ios iPhone IPO Market Markets Meta Microsoft News OpenAI samsung Social Media SpaceX startup startups tech technology Tesla TikTok trend trending twitter US

© 2025 Techstory.in

No Result
View All Result
  • News
  • Crypto
  • Gadgets
  • Memes
  • Gaming
  • Cars
  • AI
  • Startups
  • Markets
  • How to

© 2025 Techstory.in

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?