title: How to run a Java Class in Terminal
body: <p>I have done a lot of research and, I could not find how to solve my problem. I saw that there are a lot of people who ask this question, but still none of them answered it for me.</p>
  
  <p>I am a beginner at java and I made a simple calculator in Eclipse.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Calculator {
  
      public static void main(String[] args) {
  
          Scanner numInput = new Scanner(System.in);
  
          double fnum, snum;
          String operation;
  
          System.out.println("First number: ");
          fnum = numInput.nextDouble();
  
          System.out.println("Second number: ");
          snum = numInput.nextDouble();
  
          Scanner oper = new Scanner(System.in);
          System.out.println("Please select one of the following operations: ");
          System.out.println("+");
          System.out.println("-");
          System.out.println("/");
          System.out.println("*");
  
          operation = oper.next();
  
          switch (operation){
  
              case "+":
                  System.out.println("Your answer is: " + (fnum + snum));
                  break;
  
              case "-":
                  System.out.println("Your answer is: " + (fnum - snum));
                  break;
  
              case "*":
                  System.out.println("Your answer is: " + (fnum * snum));
                  break;
  
              case "/":
                  System.out.println("Your answer is: " + (fnum / snum));
                  break;
          }
      }
  
  }
  </code></pre>
  
  <p>Later I went into the Workspace folder to find the Calculator.class file.</p>
  
  <p>I opened terminal and typed:</p>
  
  <pre><code>Danylo-RIB:~ mac$ java /Users/mac/Documents/workspace/Calculator/bin/Calculator.class 
  </code></pre>
  
  <p>I followed all the instructions on how to run a class in MacOs Terminal, but all I got for an answer in my terminal instead of my program was:</p>
  
  <pre><code>Danylo-RIB:~ mac$ java /Users/mac/Documents/workspace/Calculator/bin/Calculator.class 
  Error: Could not find or load main class .Users.mac.Documents.workspace.Calculator.bin.Calculator.class
  Danylo-RIB:~ mac$ 
  </code></pre>
  
  <p>So my question is, how do I do this? How do I run a class in Terminal? </p>
  
  <p>EDIT: Okay, thanks to the people who answered my question! </p>