Java Getting Started

JK JK 2038 
Created at
Updated at  
7,533 0 0

Some PCs might have Java already installed.

To check if you have Java installed on a Windows PC, search in the start bar for Java or type the following in Command Prompt (cmd.exe):

C:\Users\Your Name>java -version

If Java is installed, you will see something like this (depending on version):

java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

If you do not have Java installed on your computer, you can download it for free at oracle.com.

Note: In this tutorial, we will write Java code in a text editor. However, it is possible to write Java in an Integrated Development Environment, such as IntelliJ IDEA, Netbeans or Eclipse, which are particularly useful when managing larger collections of Java files.


Java Quickstart

In Java, every application begins with a class name, and that class must match the filename.

Let's create our first Java file, called Main.java, which can be done in any text editor (like Notepad).

The file should contain a "Hello World" message, which is written with the following code:

public class Main {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}

For now, focus on how to run the code above.

Save the code in Notepad as "Main.java". Open Command Prompt (cmd.exe), navigate to the directory where you saved your file, and type "javac Main.java":

C:\Users\Your Name>javac Main.java

This will compile your code. If there are no errors in the code, the command prompt will take you to the next line. Now, type "java Main" to run the file:

C:\Users\Your Name>java Main

The output should be like below:

Hello World

 

Tags Java Java Environment Java Install Java Setup Facebook X
Comments 0
Similar posts
  1. Java Syntax
    7,600
  2. The Print() Method
    7,274
  3. Java Comments
    8,249
  4. Java Variables
    7,620
  5. Java Math
    7,576
  6. Java If ... Else
    7,533
  7. Java Short Hand If...Else (Ternary Operator)
    7,722
  8. Java Switch Statements
    7,545
  9. Java While Loop/Do While Loop/For Loop/For-Each Loop/Break/Continue
    8,098
  10. Java Methods
    7,202
  11. Java Scope
    7,222
  12. Java Recursion
    7,298
  13. Java Classes and Objects
    7,230
  14. What is Java?
    7,184
  15. Java Packages
    7,291
  16. Java Inheritance (Subclass and Superclass)
    7,278
  17. Java Polymorphism
    7,159
  18. Java Inner Classes
    7,189
  19. Machine Learning Types and Programming Languages
    7,367
  20. Java Tutorials associated with AP Computer Science A
    7,810
  21. Creating a simple Java Servlet (Web Server Page) with Apache Maven on Microsoft Windows
    7,290
  22. Java Servlet Example
    7,222
  23. Difference between Java and Javascript
    7,784
  24. Challenge: One Code Problem Per Day
    1,325
  1. How do I replace content that based on the HTML UI Template
    7,251
  2. Dataset of California Foodbanks
    7,270
  3. Java Abstract Classes and Methods
    7,957
  4. Java Arrays
    9,161
Recently updated
  1. Comprehensive Guide to Recent Critical PHP Vulnerabilities
    1,101
  2. How to Check Your UIUC Graduation Progress Using DARS Audit
    976
  3. Michael Jackson's Billie Jean
    452
  4. Meet A2O Lite: Korea's Newest K-Pop Cuties with Addictively Catchy Melodies
    431
  5. Why You Can't Stop Watching Jack Bryan's Beatbox Gaming Shorts
    373
  6. Song So-hee: The Soulful Voice Touching Hearts Through Korean Music
    414
  7. Watch This Dazzling Dancer’s Mind-Blowing Moves
    411
  8. Bootstrap vs. Tailwind CSS: Origins, Features, Pros & Cons, and How to Choose the Right Framework
    446
  9. The Complete Guide to Golang: History, Features, Real-World Uses, and Code Examples
    1,492
  10. Telemetry vs. Analytics: Understanding the Difference and Why It Matters
    594
  11. The Evolution and Production Reality of Agentic AI
    473
  12. How to Activate or Waive Your UIUC Student Health Insurance
    609
  13. Complete Guide to Building a Machine Learning Model
    617
  14. My life cuts at Las Vegas during Thanksgiving day holiday
    7,661
  15. The Cybercab Transformation: From Autonomous Taxi to Mobile Base Station
    625
  16. Harness vs. OpenClaw: Two Very Different "Agents"
    1,408
  17. Clean Python Environments: The Power of venv vs. Docker
    1,153
  18. What is Docker? Why is Docker also useful in a development environment?
    853
  19. UIUC 2026-2027 Academic Calendar
    2,131
  20. How to Build Llama 3 AI Apps with Python: Setup & User Prompts
    1,128
  21. Open-Source LLMs: The AI Revolution
    1,024
  22. Resume 2.0: Leveling Up for My First Software Gig
    3,150
  23. Not everyone will understand what this man just did
    2,584
  24. UIUC Dorm Guide: Find Your Perfect Fit !!
    1,915
  25. Unpacking IU's Shopper
    1,013
  26. Jackie Chan's Police Story: The Action Masterpiece
    909
  27. The IVE Story: Identity, 'I AM' Charts, and Influence
    1,259
  28. Tech Visionaries who graduated at UIUC - You are the Next Turn
    1,431
  29. Open Databases for Sex Crime Occurrences in the U.S.
    1,021
  30. Automatically copy text to the clipboard when dragging the mouse in the Cursor
    3,558
  31. My First Day at University of Illinois-Urvana Champaign
    1,412
  32. Sand, Sea, and a Splash of Fun at Newport Beach: A Family Adventure
    8,483
  33. Sun, Rocks, and Adventure: A Day at Joshua Tree National Park
    8,538
  34. Sipping the Stars: My Starbucks Adventure
    10,268
  35. Exciting explore at Sequoia National Park
    7,900
  36. My Life Shot at Death Valley
    2,130
  37. Ip Man fights with Muay Thai Master
    1,173
  38. Mad Clown - Don't Die
    1,301
  39. How to get Student Enrollment and Degree Verification at UIUC
    6,130
  40. LAX Thanksgiving Rush: A Joyful Reunion
    1,131
  41. ZO ZAZZ(조째즈) - Don`t you know (모르시나요) (PROD.ROCOBERRY)
    1,398
  42. FISHINGIRLS Unleashes Energetic EP 'Funiverse' Featuring Signature Track 'Fishing King'
    1,180
  43. 10CM - To Reach You (너에게 닿기를)
    1,365
  44. Feeling weak? Transform yourself at the UIUC ARC!
    1,776
  45. BOYNEXTDOOR - If I Say I Love You
    1,423
  46. The Future of Software Engineer - AI Engineering
    1,138
  47. G Dragon x Taeyang (Eyes Nose Lips, Power, Home Sweet Home, GOOD BOY) - LE GALA PIÈCES JAUNES 2025
    1,147
  48. Lie - Legend song by BIGBANG
    8,048
  49. Why ROLLBACK is useful when you work with Google Gemini CLI?
    1,136
  50. Reimbursement after Vaccination at McKinley Health Center
    1,262