Error: Could not find or load main class MainEX1 "[duplicate]

0

Question asked previously that gave basis to this error

The error in question is the use of a JAVA program using the Linux Terminal.

I have already compiled classes, the error appears when I try to run those same compiled classes previously:

Print Error :

      zeluis@zeluis-HP-EliteBook-8460p ~/NetBeansProjects/SOCP1/src/socp1 $ ls
      CalculatorMethodos.java  MainEX1.class  MainEX1.java
      zeluis@zeluis-HP-EliteBook-8460p ~/NetBeansProjects/SOCP1/src/socp1 $ java MainEX1
      Error: Could not find or load main class MainEX1

Code MainEX1 class

    package socp1;

import java.io.IOException;
import java.util.Scanner;


/**
 *
 * @author zeluis
 */
public class MainEX1 {

    /**
     * @param args the command line arguments if a number is not enter, the
     * system take the value as 0.
     */
    public static void main(String[] args) throws IOException {

        //EXERCICIO1
     /*   int num1, num2, total = 0, opcCalc, vef = -1;
        CalculatorMethodos cM = new CalculatorMethodos();
      //read from keyboard
        Scanner lerDataKeyBoard = new Scanner(System.in);
        // BufferedReader lerDataKeyBoard = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("First number:\n");
        num1 = lerDataKeyBoard.nextInt();
        System.out.println("Second number:\n");
        num2 = lerDataKeyBoard.nextInt();

        System.out.println("Introduza a operação:\n");
        System.out.println("'1' - SUM\n");
        System.out.println("'2' - SUBTRACT\n");
        System.out.println("'3' - MULTIPLY\n");
        System.out.println("'4' - DIVIDE\n");

        opcCalc = lerDataKeyBoard.nextInt();

        switch (opcCalc) {
            case 1:
                total = cM.add(num1, num2);
                break;
            case 2:
                total = cM.sub(num1, num2);
                break;
            case 3:
                total = cM.sub(num1, num2);
                break;
            case 4:
                total = cM.div(num1, num2);
                break;
        }
        System.out.println("Resultado:" + total); */

     //EXERCICIO 2
       int num1, num2, total = 0, opcCalc, vef = -1;
       // CalculatorMethodos cM = new CalculatorMethodos();
      //read from keyboard
        Scanner lerDataKeyBoard = new Scanner(System.in);
        // BufferedReader lerDataKeyBoard = new BufferedReader(new InputStreamReader(System.in));
    /*    System.out.println("First number:\n");
        num1 = lerDataKeyBoard.nextInt();
        System.out.println("Second number:\n");
        num2 = lerDataKeyBoard.nextInt(); */


        System.out.println("Introduza a operação:\n");
        System.out.println("'1' - SUM\n");
        System.out.println("'2' - SUBTRACT\n");
        System.out.println("'3' - MULTIPLY\n");
        System.out.println("'4' - DIVIDE\n");

        opcCalc = lerDataKeyBoard.nextInt();

        switch (opcCalc) {
            case 1:
              //  total = cM.add(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
                break;
            case 2:
              // total = cM.sub(args[0], args[1]);
                break;
            case 3:
             //   total = cM.sub(args[0], args[1]);
                break;
            case 4:
               // total = cM.div(args[0], args[1]);
                break;
        }
        System.out.println("Resultado:" + total);

    }

    }
    
asked by anonymous 18.11.2017 / 16:23

0 answers