Netbeans, indeed any Java compiler and executor, needs to know the classpath to compile and run a file. When you just open a file in Netbeans, you do not tell it any of that information. When you set up a project, that process tells Netbeans where the Java resources are.Netbeans, indeed any Java compiler and exec