Error Can not find or load the main class (Java)

advertisements
import java.util.Scanner;

public class Twk {

    public static void main(String[] Twk) {

        System.out.println("Welcome to Twk");
        Scanner enterName = new Scanner(System.in);
        String name = enterName.next();

    }

}

Why does it happen? Twk.java and Twk.class are at the same place. Need some helps, thanks.

Error: Could not find or load main class Twk https://i.stack.imgur.com/NlcUu.png


Try with java -cp . Twk, this will probably let the java command "sees" the Twk.class file