Scanner.next() - Exception in thread "main" java.util.InputMismatchException
<p>Hi guys I am a total newbie. Please help me.</p>

<p>The program is:</p>

<pre><code>import java.util.Scanner.*;
import java.lang.*;
public class HexToDecimalFromWeb{
public static void main (String [] args) {
    Scanner input = new Scanner(System.in);
    printHeader();
    while (true) {
        String hex = input.next("Enter a hexadecimal number: ");
        int dec = Integer.parseInt(hex, 16);
        if (dec == SENTINEL) {
            break;
        }
        System.out.println(hex + " hex = " +  
         Integer.toString(dec)+ "decimal");
    }
}
private static void printHeader() {
    System.out.println("This program converts hexadecimal to decimal.");
   System.out. println("Enter 0 to stop.");
}
private static final int SENTINEL = 0;
}
</code></pre>

<p>The error I get is this:</p>

<pre><code>java.lang.NoClassDefFoundError: HexToDecimalFromWeb
Caused by: java.lang.ClassNotFoundException: HexToDecimalFromWeb
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
</code></pre>

<p>What is the reason for that?</p>

<p>I think it may be an issue with Eclipse as some other programs won't run either.</p>

<p>11.2019 UPDATE :</p>

<p>I tried to execute this code again in a different IDE, this is not a problem with Eclipse. The error I am getting is this:</p>

<pre><code>Exception in thread "main" java.util.InputMismatchException
at java.base/java.util.Scanner.throwFor(Scanner.java:939)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.next(Scanner.java:1525)
at HexToDecimalFromWeb.main(HexToDecimalFromWeb.java:12)
</code></pre>