the main class was not found

3

Hello at the moment of compiling the TEST FILE in the console with javacc I get it

  

"Error: the main class was not found or loaded   ProjectCompi.java "

This is my JJ FILE:

>PARSER_BEGIN(ProyectoCompi)
>class ProyectoCompi{
>   public static void main(String[] args) throws ParseException{
>       try{
>           ProyectoCompi analizador = new ProyectoCompi(System.in);
>           analizador.programa();
>       }catch(ParseException e){
>           System.out.println(e.getMessage());
>           System.out.println("Analizador: Se han encontrado errores en el analisis");
>       }
>   }
>}
>PARSER_END(ProyectoCompi)
>
>TOKEN:{
>   <MAIN: "public static void main()"> {System.out.println("Main -> " + image);}
>}
>
>TOKEN:{
>   <LPAREN: "(">{System.out.println("PARENTIZQ -> " + image);}
>   |<RPAREN: ")">{System.out.println("PARENTDER -> " + image);}
>   |<LBRACE: "{">{System.out.println("LLAVEIZQ -> " + image);}
>   |<RBRACE: "}">{System.out.println("LLAVEDER -> " + image);}
>   |<COMA: ",">{System.out.println("COMA -> " + image);}
>   |<SEMICOLON: ";">{System.out.println("PUNTO Y COMA -> " + image);}
>}
>
>TOKEN:{
>   <ASIGNACION: "=">{System.out.println("ASIGNACION -> " + image + "\r\n");}
>   |<SUMA: "+">{System.out.println("SUMA -> " + image + "\r\n");}
>   |<RESTA: "-">{System.out.println("RESTA -> " + image + "\r\n");}
>   |<PRODUCTO: "*">{System.out.println("SUMA -> " + image + "\r\n");}
>   |<IMPRIMIR: "imprimir ">{System.out.println("IMPRIMIR -> " + image + "\r\n");}
>}
>
>TOKEN:{
>   <COMPLEJO: "Complejo ">{System.out.println("COMPLEJO -> " + image);}
>   |<NUMBER: (["0"-"9"])+>{System.out.println("NUMERO -> " + image);}
>   |<IDENTIFIER: (["a"-"z","A"-"Z"])+>{System.out.println("IDENTIFICADOR   -> " + image + "\r\n");}
>}
>
>SKIP:{
>   " " | "\r\n" | "\t" | "\t\t" | "\t\t\t"
>}
>
>void Programa():
>{}
>{
>   <MAIN><LBRACE>Sentencias()<RBRACE><EOF>
>}
>
>void Sentencias():
>{}
>{
>   DeclaracionLocal()
>}
>
>void DeclaracionLocal():
>{}
>{
>
>   <COMPLEJO><IDENTIFIER>(DeclaracionSimple() | DeclaracionCompleja() | DeclaracionCombinada())  <SEMICOLON> recursivo()
>}
>
>void recursivo():
>{}
>{
>   DeclaracionLocal()
>}
>
>void DeclaracionSimple():
>{}
>{
>   (<COMA><IDENTIFIER>)*
>}
>
>void DeclaracionCompleja():
>{}
>{
>   <LPAREN><NUMBER><COMA><NUMBER><RPAREN> (<COMA><IDENTIFIER> <LPAREN><NUMBER><COMA><NUMBER><RPAREN>)*
>}

>void DeclaracionCombinada():
>{}
>{
>   ((DeclaracionSimple() | DeclaracionCompleja())<COMA>)*((DeclaracionSimple() | DeclaracionCompleja()))
>}

TEST FILE:

    public static void main(){
        Complejo a;
        Complejo a,b;
        Complejo a,b(5,4);
        Complejo a(5,4);
        Complejo a(5,4),b;
        Complejo a,b(5,4),c;
        Complejo a(5,4),b,c(6,5);
    }
    
asked by NriKe 26.06.2016 в 23:03
source

1 answer

4

This error

  

"Error: the main class was not found or loaded"

can have several causes, related to the fact that the compiler simply can not find the class.

  • The name of the class is not correct.
  • The package is not correct.

Execute javacc in the folder containing the file .jj

    
answered by 27.06.2016 / 03:12
source