Create a Java program WITHOUT some fancy IDE

How to create a JAVA application WITHOUT the use of a Commercial IDE

Recently I decided I was bored and needed to learn something new. So I decide to try JAVA seeing as that was the Language that many others on this forum had chosen.

But unlike everyone else here. I wanted to learn from the ground up, and not rely on some fancy IDE.
Or I wanted to learn ‘Long Division’ before buying a calculator.

It took me hours of research, and consultations with both Norman and Thorsten. Before I was able to ferret out a series of steps the worked. So here is ONE approach. If anyone has alternative syntax or steps feel free to let me know.

NOTE : These steps are specific to macOS, but should be “mostly” the same for Window/Linux

Step 01
Decide on the NAME for you application [we will use ‘FOO’ here]
you should of course select a name that is appropriate for your project

Step 02
Create an empty directory structure with the name of your application [FOO]

Step 03
write your java source using your favorite Text Editor
[IMPORTANT… each file MUST use ‘.java’ as the extension]
store these files in the FOO directory
Note : the hows and whys of the actual Java programming language syntax can be found elsewhere

Step 04
execute TERMINAL
navigate to the FOO directory you created above
compile your Java Source using this command

javac -classpath . *.java

This tells java to compile ALL *.java files located in the current directory [-classpath .]

use javac --help if you want to see more compiler options

Step 05
in your favorite text editor create a file named ‘MANIFEST.MF
Edit this file and insert the following lines

IMPORTANT! this file must contain no addtional whitespace, there are no spaces BEFORE the “:” and only ONE after it, and the file MUST end with a Linefeed

Main-Class: XXXXX

Replace XXXX with the class name from one of your .java files that is “main”, see example below

Step 06
create a JAR file from everything… a JAR is a Java ARchive

jar -cmvf MANIFEST.MF foo *.class

Step 07
Execute your new Java program using

java -jar foo

Example :

Create a Directory named “OldMac”
copy these 3 files

File #1 - name

 public class OldMacDriver {
      public static void main( String[] args ) {
           OldMacCow maudine = new OldMacCow();
           OldMacCow pauline = new OldMacCow();
           OldMacDuck ferdinand = new OldMacDuck();

File #2 - name

public class OldMacCow {
   public void moo() {
      System.out.println("Cow still says moo.");

File #3 - name

public class OldMacDuck {
   public void quack() {
      System.out.println("Duck still says quack.");

here are our “steps”
Step 01 - name of our App is “OldMac”

Step 02 - we created our directory

Step 03 - we added 3 .java source code files

Step 04 - go to terminal, CD to “OldMac” and execute
javac -classpath . *.java
this will create a .class version of each .java file

Step 05 - create a file called 'MANIFEST.MF" with the contents

Manifest-Version: 1.0
Main-Class: OldMacDriver

NOTE : ‘OldMacDriver’ is the class named in our 1st Java file above

Step 06 - create a JAR file using

jar -cmvf MANIFEST.MF OldMac *.class

Step 07 - Run it

java -jar oldmac

Output should be

Cow still says moo.
Cow still says moo.
Duck still says quack.

Note… this is a SIMPLE example… and I’ll be honest , if there are issues, I may or may not be able to help… I myself have just started to learn all of this

But I hope this helps