I mean by in general compiling a code, without using any development environment. Only by using the Terminal as it is called in Mac OS. In windows they call it Command Prompt (the commands differ a bit compared to Terminal).
STEPS:
- To change the directory in Terminal use cd:
- Then, add the directory were your class file is saved.
- ? How to know where your file is saved ?
- Use the command ls to show the files in the map
- Next, compile the file:Use javac as command to compile a file
- After the command, enter the file name in this case is the:
- name: C
- type of the file: .java
- run the file to check if it is successfully compiled:
- because this is the code for file C.java
the code is successfully compiled
- because this is the code for file C.java