简体   繁体   中英

(Java) couldn't find or load main class

I'm new in java and i need some help, i know there's a lot of threads about the same but i couldn't find how to solve this problem with the class.

To compilate

alpha@Alpha-:~$ javac ~/Escritorio/Test/EXAMPLE.java

EXAMPLE.class is in "Test" folder

When i try to run it

alpha@Alpha:~$ java -cp /~/Escritorio/Test EXAMPLE
Error: no se ha encontrado o cargado la clase principal EXAMPLE
(Error: couldn't find or load main class EXAMPLE)

I have Ubuntu 12.04.2

java and javac version 1.7.0_51

EXAMPLE.java

public class EXAMPLE
{
   public static void main(String[] args)
   {
     System.out.println("¡Mi primer programa!");
   }
}

just do

alpha@Alpha:~$ cd ~/Escritorio/Test
alpha@Alpha:~$ javac Example.java
alpha@Alpha:~$ java Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM