Java in the Terminal

Learning How to Run Java using Only the Command Line

Jordan Williams
Level Up Coding
Published in
7 min readJan 26, 2021

--

Photo by Marissa Anderson with required license for use

I don’t know if it’s how I was taught Java but my go-to method of running it is through the terminal. I enjoy the “hacker vibe” you get from being able to just use the keys on your keyboard to control the execution of a program.

In this article, I will be sharing how you can run your Java programs inside the command line.

Requirements:

  • Java — This must be installed and should be set as an environment variable.

Note: This demonstration will be done on a windows machine.

Running Your Programs In The Terminal

Running your Java programs from the command line gives an appreciation to the entire compilation and execution process that happens when executing your Java programs.

Let’s Begin!

We’ll start off by running a single Java file but first, let’s create that file. To create a single Java file, all that is needed is the name of the file plus the .java extension as shown below with DemoTerminal.java .

--

--

Enjoys creating software that make tasks simpler. Always trying to gain new knowledge and expertise.