javanetbeansnoclassdeffounderror.class-file

Java .class file disappeares as soon as I run the project


I've been on a project where I build tetris that has multiplayer, and it's been working for a couple of days with no problem, but now suddenly there's this exception:

Exception in thread "main" java.lang.NoClassDefFoundError: Game/Piece

This basically means it can't find the .class of my class called Piece, but whenever I do a "clean and build" the .class file appears, then instantly disappears when I run the project.

This is my project structure (running with JDK 16, in netbeans):

enter image description here

Is there a reason for this exception?

My JAVA_HOME variable: jdk1.8.0_131.


Solution

  • So apperantly I had a warning (not an error) when compiling, it said something was depracated, so I had to add a compiler option name -Xlint:(something here I can't remember), so when I compiled it the issue was obvious, JFrame.hide() is a depracated function so I just had to remove it. It's weird that the runtime error was "NoClassDefFoundError" which has nothing to do with the issue.