Java Getting Started

JK 2010 
Created at
Updated at  
7,384 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,413
  2. The Print() Method
    7,136
  3. Java Comments
    7,965
  4. Java Variables
    7,426
  5. Java Math
    7,411
  6. Java If ... Else
    7,370
  7. Java Short Hand If...Else (Ternary Operator)
    7,546
  8. Java Switch Statements
    7,379
  9. Java While Loop/Do While Loop/For Loop/For-Each Loop/Break/Continue
    7,814
  10. Java Methods
    7,063
  11. Java Scope
    7,074
  12. Java Recursion
    7,182
  13. Java Classes and Objects
    7,061
  14. What is Java?
    7,074
  15. Java Packages
    7,159
  16. Java Inheritance (Subclass and Superclass)
    7,164
  17. Java Polymorphism
    7,036
  18. Java Inner Classes
    7,028
  19. Machine Learning Types and Programming Languages
    7,215
  20. Java Tutorials associated with AP Computer Science A
    7,562
  21. Creating a simple Java Servlet (Web Server Page) with Apache Maven on Microsoft Windows
    7,150
  22. Java Servlet Example
    7,103
  23. Difference between Java and Javascript
    7,575
  24. Challenge: One Code Problem Per Day
    1,050
  1. Java Abstract Classes and Methods
    7,676
  2. Java Classes and Objects
    7,061
  3. Java Recursion
    7,182
  4. Java Scope
    7,074
  5. Java Methods
    7,063
  6. Java Arrays
    8,629
  7. Java While Loop/Do While Loop/For Loop/For-Each Loop/Break/Continue
    7,814
  8. Java Switch Statements
    7,379
  9. Java Short Hand If...Else (Ternary Operator)
    7,546
  10. Java If ... Else
    7,370
  11. Java Math
    7,411
  12. Java Variables
    7,426
  13. Java Comments
    7,965
  14. The Print() Method
    7,136
  15. Java Syntax
    7,413
  16. What is Java?
    7,074
Recently updated
  1. Bootstrap vs. Tailwind CSS: Origins, Features, Pros & Cons, and How to Choose the Right Framework
    88
  2. The Complete Guide to Golang: History, Features, Real-World Uses, and Code Examples
    224
  3. Telemetry vs. Analytics: Understanding the Difference and Why It Matters
    184
  4. The Evolution and Production Reality of Agentic AI
    174
  5. How to Activate or Waive Your UIUC Student Health Insurance
    253
  6. Complete Guide to Building a Machine Learning Model
    296
  7. My life cuts at Las Vegas during Thanksgiving day holiday
    7,376
  8. The Cybercab Transformation: From Autonomous Taxi to Mobile Base Station
    320
  9. Harness vs. OpenClaw: Two Very Different "Agents"
    918
  10. Clean Python Environments: The Power of venv vs. Docker
    786
  11. What is Docker? Why is Docker also useful in a development environment?
    591
  12. UIUC 2026-2027 Academic Calendar
    1,506
  13. How to Build Llama 3 AI Apps with Python: Setup & User Prompts
    772
  14. Open-Source LLMs: The AI Revolution
    726
  15. Resume 2.0: Leveling Up for My First Software Gig
    2,116
  16. Not everyone will understand what this man just did
    1,751
  17. UIUC Dorm Guide: Find Your Perfect Fit !!
    1,555
  18. Unpacking IU's Shopper
    719
  19. Jackie Chan's Police Story: The Action Masterpiece
    616
  20. The IVE Story: Identity, 'I AM' Charts, and Influence
    920
  21. Tech Visionaries who graduated at UIUC - You are the Next Turn
    1,154
  22. Open Databases for Sex Crime Occurrences in the U.S.
    688
  23. Automatically copy text to the clipboard when dragging the mouse in the Cursor
    2,549
  24. My First Day at University of Illinois-Urvana Champaign
    1,161
  25. Sand, Sea, and a Splash of Fun at Newport Beach: A Family Adventure
    8,094
  26. Sun, Rocks, and Adventure: A Day at Joshua Tree National Park
    8,171
  27. Sipping the Stars: My Starbucks Adventure
    9,595
  28. Exciting explore at Sequoia National Park
    7,624
  29. My Life Shot at Death Valley
    1,649
  30. Ip Man fights with Muay Thai Master
    911
  31. Mad Clown - Don't Die
    983
  32. How to get Student Enrollment and Degree Verification at UIUC
    4,695
  33. LAX Thanksgiving Rush: A Joyful Reunion
    901
  34. ZO ZAZZ(조째즈) - Don`t you know (모르시나요) (PROD.ROCOBERRY)
    1,088
  35. FISHINGIRLS Unleashes Energetic EP 'Funiverse' Featuring Signature Track 'Fishing King'
    952
  36. 10CM - To Reach You (너에게 닿기를)
    1,134
  37. Feeling weak? Transform yourself at the UIUC ARC!
    1,552
  38. BOYNEXTDOOR - If I Say I Love You
    1,163
  39. The Future of Software Engineer - AI Engineering
    915
  40. G Dragon x Taeyang (Eyes Nose Lips, Power, Home Sweet Home, GOOD BOY) - LE GALA PIÈCES JAUNES 2025
    886
  41. Lie - Legend song by BIGBANG
    7,791
  42. Why ROLLBACK is useful when you work with Google Gemini CLI?
    811
  43. Reimbursement after Vaccination at McKinley Health Center
    986
  44. Gemini CLI makes a Magic! Time to speed up your app development with Google Gemini CLI!
    942
  45. Common Questions from UIUC school life in terms of CS Program
    1,085
  46. UIUC Immunization Compliance
    1,177
  47. LEE CHANHYUK's songs really resonate with my soul - Time Stop! Vivid LaLa Love, Eve, Endangered Love ...
    1,071
  48. LEE CHANHYUK - Endangered Love (멸종위기사랑)
    1,072
  49. Cupid (OT4/Twin Ver.) - LIVE IN STUDIO | FIFTY FIFTY (피프티피프티)
    848
  50. Common methods to improve coding skills
    969