Episode 2, Write a Java App

Episode 2, Write and Run Java App

Season 1 - From Lame to Fame

app = application

This tutorial is intended for beginners, if is too detailed for you, go and cry in a corner, then come back when done

  1. Open the file manager (quite often the shortcut is Win + E)
    1. Navigate to your home folder
    2. The home folder is open by default usually, if that’s not the case then navigate to your home folder.
    3. Often this shortcut works Alt + Home.
    4. Create a folder with the name lameapp
    5. Open this lameapp folder and create a simple text file with the name LameApp.java

    Open Documents

    1. Create a folder with the name lameapp
    2. Open this lameapp folder and create a simple text file with the name LameApp.java
    1. Navigate to your home folder
    2. Create a folder with the name lameapp
    3. Open this lameapp folder and create a simple text file with the name LameApp.java
  2. Use a simple text editor to edit LameApp.java file (e.g. Notepad, Notepad++, Kate, Kwrite, Gedit, Nano, vim)
  3. Type the following content (no copy/pasting you little… you know the word):
public class LameApp {

  public static void main(String[] args) {

    System.out.println("This is it!");
    System.out.println("My name is Jon Snow and I know nothing!");
    System.out.println("Write more lines like that and feel yourself being [Thanos Level] powerful!");

  }
}
  1. Check that you wrote everything, letter by letter and symbol by symbol
  2. Double check 3 times, so that you’ll have it checked 7 times in total (seven is a lucky number)
  3. Now save the file and open a terminal or command line
    Press Ctrl + Alt + T

    Press Win + R then Enter then type cmd then hit enter with all your inner force, my young padavan

    Find a funny icon that look like a black window and click on it
  4. Navigate to the folder of this file
  5. Usually done with command cd (Change Directory)
    Type in terminal cd /home/$USER/lameapp and hit Enter
    Type in command line cd %USERPROFILE%\Documents and hit Enter
    Type in terminal cd /Users/$USER/lameapp and hit Enter
  6. Now let’s do the fun part, let’s copile and run this piece of… marvel
  7. First, we compile by typing in terminal javac LameApp.java then hitting Enter because we can
    1. Another file will be created with the name LameApp.class, one more lame file in this world
  8. Second, we run the thing by typing in terminal java LameApp
  9. Now you cry and feel happy, you are not so lame as you thought
You did it my friend, enjoy happiness!