Code in Java without an IDE

Last Updated on

Time needed: 5 minutes

It's rather unpractical to code in Java this way, but in this tutorial I'll show that for simple applications, the whole process is very straightforward. All we need is a Java Development Kit and the favorite text editor.

Let's create a file called MyProject.java

public class MyProject {
    public static void main(String[] args) {
        System.out.println("I was made without an IDE!");
    }
}

Now we have to open terminal (or PowerShell / cmd in Windows) and compile it with the following command:

javac MyProject.java

It will create a new file, MyProject.class. The .java file has been translated by javac to .class file, which is more suitable to be executed by machines. The following command will execute it:

java MyProject.java

And you should see the message written by us in the terminal:

I was made without an IDE!

Leave a Reply