SyntaxStudy
Sign Up
Java What Is Java and Setting Up the JDK
Java Beginner 1 min read

What Is Java and Setting Up the JDK

Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. It follows the "write once, run anywhere" philosophy: compiled Java bytecode can run on any platform that has a Java Virtual Machine (JVM) installed without recompilation. Java was originally developed by James Gosling at Sun Microsystems and released in 1995, and it remains one of the most widely used languages in enterprise software, Android development, and backend systems. Setting up a Java development environment begins with downloading and installing the Java Development Kit (JDK). The JDK includes the compiler (javac), the runtime environment (JRE), and many utilities. After installation you configure the JAVA_HOME environment variable to point to the JDK directory and add its bin folder to your system PATH so that the java and javac commands are available from the terminal. Once the JDK is installed you can verify the setup by running java -version and javac -version in a terminal. From there you can write your first Java source file, compile it with javac, and run the resulting .class file with the java command. Most developers also install an IDE such as IntelliJ IDEA or Eclipse to get code completion, refactoring tools, and integrated debugging.
Example
// File: HelloWorld.java
// Compile: javac HelloWorld.java
// Run:     java HelloWorld

public class HelloWorld {

    /**
     * The main method is the entry point for every Java application.
     * The JVM looks for this exact signature when starting execution.
     *
     * @param args command-line arguments passed to the program
     */
    public static void main(String[] args) {
        // Print a greeting to standard output
        System.out.println("Hello, World!");

        // Print the current Java version at runtime
        String version = System.getProperty("java.version");
        System.out.println("Running on Java " + version);

        // Demonstrate System.out.printf for formatted output
        String name = "Java Developer";
        System.out.printf("Welcome, %s!%n", name);

        // Show that args can be iterated
        if (args.length > 0) {
            System.out.println("Command-line arguments received:");
            for (String arg : args) {
                System.out.println("  " + arg);
            }
        } else {
            System.out.println("No command-line arguments were provided.");
        }
    }
}