Skip to Content
Codecademy Logo

Getting Started with Java

Print Cheatsheet

Command Line

In order to run a Java program from the command line, you must first compile it using:

javac MyClassName.java

You can then run it using:

java MyClassName