Java Getting Started
Set up once. Run your first program.
Read this topic in தமிழ் ↗.
By the end of this lesson, you can…
- Explain the key idea behind Getting Started.
- Read and run a complete example, then predict what changes.
- Recognize the topic-specific mistake discussed below.
Understand the idea
For local development, install a JDK, which includes the tools needed to compile and run Java. Confirm both java -version and javac -version in a fresh terminal. Save the example as Main.java, compile with javac Main.java, and run with java Main from the directory containing the compiled class. The browser editor below provides a separate environment; it does not install Java on your computer.
Explore the details
A local setup checklist
- Install a JDK from a trusted distribution.
- Open a fresh terminal and check java -version and javac -version.
- Choose an editor and create a file named Main.java.
- Compile with javac Main.java, then run with java Main.
Compiler and runtime versions must be compatible. If a command is not found, check the installation and PATH rather than repeatedly reinstalling unrelated editor extensions.
A complete runnable example
This complete Main.java program focuses on the lesson idea. Reference fragments above may demonstrate individual statements; this example includes the imports, entry point, and supporting types it needs.
public class Main {
public static void main(String[] args) throws Exception {
System.out.println("My Java setup is working!");
}
}Predict first. Then reveal the expected output / வெளியீடு
My Java setup is working!
The output shown was checked by running this complete example. Trace the executed statements in order, then compare with your run.
Change it. Run it. Understand it.
Load this lesson example into the editor. Change one value or statement, predict the result, then press RUN to execute Java.
Powered by OneCompiler. Code you run is sent to OneCompiler for execution. For Scanner examples, supply input in the editor I/O panel; for file examples, files exist in its execution environment.
Make it your own
Practice challenge
Run the example in the browser, then reproduce it locally using the two commands above.
Reveal the answer and reasoning / விடை
Both runs should print the same message. If javac is not found locally, check that you installed a JDK and configured the terminal PATH.
One mistake to avoid: An online compiler working successfully does not prove your local JDK is configured. Check the local compiler separately.
Your learning checkpoint
- Explain the example without reading the output first.
- Make the change requested in the practice task.
- Describe why the result changed—or why compilation failed.
Ready to move on? Follow the next lesson in course order, or return to the curriculum to review a prerequisite.