FAQ: Hello World: Java - Compilation: Creating Executables

OO…!!, thanks, i didn’t noticed that thanks… : }

1 Like

Honestly, the instruction is so confusing. That whales comes out of nowhere which confused people. I found out later that it is just a random name used as an example. Need to fix the wording to make it easier to understand image

if what I learned is correct, 「ls」 used to list/show all the existing .java file and executable .class file.
use it anytime you want to check what kind of file you currently have.

javac (short of “java compile” maybe?) used to compile .java file → javac (insert your file name here).java
In this lesson: javac Compiling.java

if there is no error, compiling your code will give you an executable .class file.
which you can execute using → java (insert file name here)
In this lesson: java Compiling

Yep, it looks like you’ve understood almost all of it correctly. One thing I’d like to point out is that ls doesn’t just list all the .java and .class files you have. Rather, it lists all the files and directories inside of the current directory. For example, it could list the following (blue whales is a directory, or folder).

Whales.java
Whales.class
whale.jpg
blue whales
1 Like

The exercise says that compiling creates a an executable File.class file from the File.java one. Where is this file stored in the computer? How do I access the containing folder? Is this file stored permanently on my machine (this would mean that running many programs will create many class files and hence it would be a good idea to clean out the programs I will not be using often)? If I compile the same File.java again, is the File.class overwritten or is a copy created and the last copy is running when I call the program?
Thanks.