GENTLE JAVA READER/WRITER:
Understanding the process of composing, compiling and executing a Java program will make you a better
debugger and a more flexible coder.
This page briefly describes important pieces of that process; however, it glosses over or omits sundry details.
For example, sometimes source code files produced by an editor are not successfully translated into .class files by the
javac compiler.
When this happens, you have to figure out what went wrong and fix the problem.
Sometimes steps may be hidden from view. If you edit a Java program on a website like
compilejava.net, for example,
you might not realize that .java and .class files are being created on a server somewhere — but they are!
Details may also be lurking behind a curtain if you use a Java
integrated development environment (IDE)
to work with programs locally, as opposed to on a
remote computer.
|
Foobar ☠ FUBAR
- Edit. textEditor ⇐ sourceCode
- Save. textEditor ⇒ Foobar.java
- Compile.
javac Foobar.java ⇒ Foobar.class
- Execute.
java Foobar ⇒ Error:
Main method not found
|
A Procedure
- A person’s brain creates ideas;
- Ideas are converted to human output;
- Human output becomes computer input;
- Computer input goes to a source code editor;
- A source code editor produces .java files;
- The .java files are read by the javac compiler;
- The javac compiler produces .class files;
- The .class files are read by the java loader;
- The java loader produces program output;
- Program output becomes human input;
- Human input goes to a person’s brain;
- A person’s brain interprets the input; repeat.
|
- Toe bone connected to the foot bone
- Foot bone connected to the heel bone
- Heel bone connected to the ankle bone
- Ankle bone connected to the shin bone
- Shin bone connected to the knee bone
- Knee bone connected to the thigh bone
- Thigh bone connected to the hip bone
- Hip bone connected to the back bone
- Back bone connected to the shoulder bone
- Shoulder bone connected to the neck bone
- Neck bone connected to the head bone
- Now hear the word of the Lord.
|
JDK: The Kit Behind the Curtain
Java was originally developed by
James Gosling
at
Sun Microsystems, which was subsequently acquired by
Oracle Corporation.
“The” Java Development Kit
(JDK) is an implementation of the
Java Platform Standard Edition,
Java Platform Enterprise Edition,
or Java Platform Micro Edition
platforms released by Oracle Corporation in the form of a binary product aimed at Java developers on Solaris, Linux, macOS or Windows.
JDK packages can be downloaded from Oracle.
Besides a text editor, the necessary permissions,
and perhaps a command-line interface,
a JDK is all you need to create and execute Java programs.
It’s often the kit behind the curtain.
Before proceeding much further, you really ought to know how to create, update, and keep track of text files stored in folders or directories—either
on your local computer, on a server that your computer is configured to communicate with, or in some place that you know how to get to in the cloud.
Being able to type efficiently and accurately is also an important skill to have.
Remediation of questionable text editing or file management skills is strongly encouraged.
“Gentle reader, may you never feel what I then felt! May your eyes never shed such stormy, scalding, heart-wrung tears as poured from mine. May you never appeal to Heaven in prayers so hopeless and so agised as in that hour left my lips: for never may you, like me, dread to be the instrument of evil to what you wholly love.”
— Charlotte Brontë, Jane Eyre