Launching the program




So Im in the process of learning Java. I've made some very simple programs in jGrasp but I have no idea how to actually save it as a launchable program and see it in action. Please help!

import java.util.Scanner;

public class Project1

   public static void main (String [] args)
      Scanner in = new
    Scanner (;
      String action = ("");
               System.out.println("What would you like to do?");
         if (action.equals("Tell me Im pretty"))
               System.out.println("You're gorgeous!");
         else if (action.equals("Read me my file"));
            System.out.println("You're over 40, work long hours and you regret giving birth to your kids.");
               System.out.println("I'm so sorry, that was your mothers file!");
                  System.out.println("It seems like I've accidentaly erased your file, can we fill it out again?");
         String answer1 = ("");
            answer1 = in.nextLine();
               if (answer1.equals("Sure"))
                   System.out.println("Okay! How old are you?");
               else if (answer1.equals("Yes"));
                  System.out.println("Okay! How old are you?");
               int age =(0);
                  age = in.nextInt();
                     System.out.println("Alright, so youre " + age);


If you want us to help, can you print out your current code and what you want to do precisely.
P.-S. This category is used for JavaScript not Java (please don't get confused between these two languages). If this isn't any related to Codeacademy's platform course, please post it in the corner bar category in the community category.


@miniapple8888 Alright! I changed that and put in the code.


Put your code in a file named, then run in a terminal:

java Project1

This requires you to have jdk installed, and if you're on windows you might need to do some extra steps to add java and javac to your PATH

Here's one tutorial for installing:
there are certainly many more to be found by googling.

You can also run it in here: (use nano to create a file, paste, save and exit nano and then run the above commands)

jGrasp is some sort of IDE so it might have buttons for compiling and running the program for you. I'd still recommend cutting out the middle man though, I'm not a fan of IDE's for educational purposes.