import java.util.Scanner;
import java.io.*;
import java.io.FileNotFoundException;
public class bookreader {
public static void main(String[] args) throws FileNotFoundException {
//...
}
}
When I run this code normally it spits out:
Exception in thread "main" java.lang.ClassNotFoundException: bookreader
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
When I debug the code it spits out:
Error: Could not find or load main class bookreader
I'm pretty sure both errors are the same, but I don't know how to fix either of them. Other answer point towards it running as a wrong file type, but the name of the file is bookreader.java
which should run it in Java like needed in Intellij.