APCS: Creating a Basic File and Class on Terminal

Today we looked over creating a simple file and class on Terminal.

Through terminal, we were able to look through the difference functions that we could perform on the terminal bash.

The first step to the task of creating a file that we could carry out included creating a directory on our desktop, to do this, we use the syntax: ‘ cd desktop (finding the directory for the desktop) –> mkdir HelloWorld.java (creating the folder which will include the java file –> nano HelloWorld.java (opening the editing directory for the file)’ 

This opens up a directory on terminal that looks different (^^^as inserted above^^^)

Within this tab, we inserted the syntax:

public class HelloWorld {
public static void main( String[] args ) {
System.out.println( “Hello World!” );
System.exit( 0 ); //success

This, followed by:

‘ javac HelloWorld.java ‘


‘ less HelloWorld.java ‘

summons a window that shows you what it looks like on a window without code : )



Leave a Reply