Basic Java Tutorial

What You Need ...

Here We Go ...

  1. Test if Java is working on your machine. Open your command prompt.

    Command Line
        C:\>java --version   
                 
    
    Output
        java 12.0.2 2019-07-16
        Java(TM) SE Runtime Environment (build 12.0.2+10)
        Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
                 
    

  2. Create A File named JavaApplication.java in C:

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

  3. Run the command below to RUN your java program.
    Command Line
        C:\>java JavaApplication.java   
                 
    

    Output
        Hello World !!!   
                 
    
Why Is It Not Working?
  • Make sure you executed the command to run the java class in the SAME folder. In our example, we run it in the C:\. Check if the drive letter is the same.
  • Starting JAVA 11, you no longer need to execute "javac". Please check your Java Version if you encounter any error.