# 1.3 Java Workflow

Taking a program from a `.java` file into an executable has two main steps in Java: **compilation** and **interpretation**.

<figure><img src="https://4167529814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fhc2CLpiFlye0oMpx90vL%2Fuploads%2Fgit-blob-704d784ff81f7d164c6b5a70f23f125d7f46be5c%2F1-2-compile-interpret.svg?alt=media" alt=""><figcaption></figcaption></figure>

To run the code in `Hello.java`, we must first **compile** the code into a `.class` file, which we can do using the command `javac HelloWorld.java`. Then, to run the code, we would use the command `java HelloWorld`.

In your terminal, the result would look like the following:

```
$ javac HelloWorld.java
$ java HelloWorld
Hello World!
```

## Class Files

There are several reasons for the usage of `.class` files, which we will only cover briefly here. First of all, `.class` files are guaranteed to have been type-checked, making the distributed code safer. They are also more efficient to execute, and protect the actual source code in cases of intellectual property. We will not go into the details of `.class` files in this textbook beyond knowing that they are created after compilation.

## IntelliJ

In our class, we'll instead be using an IDE called IntelliJ. This will be introduced in HW1. Note that IntelliJ performs the two step process above, but hides the details from the end user, i.e. you don't notice that it separately creates a .class file before running.
