I’m new to java and i have a problem while trying to run my program. I’m using eclipse.
import java.util.Scanner;
public class Scan {
public static void main(String[] args) {
String imie;
Scanner odczyt = new Scanner(System.in);
imie=odczyt.nextLine();
System.out.println("Witaj "+imie);
}}
This what I get:
EDIT(Runned without dot)
Exception in thread "main" java.lang.NoClassDefFoundError: Scan
Caused by: java.lang.ClassNotFoundException: Scan
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Scan. Program will exit.
Please help me. 🙂
When you’re running
java, don’t put.javaon the end of the class name.