开发者

java.lang.NoClassDefFoundError - except the class exists

开发者 https://www.devze.com 2023-04-04 14:22 出处:网络
I\'m using NetBeans IDE to code my Ja开发者_如何学运维va program. A few days ago, I had it working the way I wanted to. Now that I opened it again to add some changes and comments, this java.lang.NoCl

I'm using NetBeans IDE to code my Ja开发者_如何学运维va program. A few days ago, I had it working the way I wanted to. Now that I opened it again to add some changes and comments, this java.lang.NoClassDefFoundError popped up suddenly. I have searched around but I can't seem to find a proper answer. I have set my CLASSPATH to my Java folder (*C:\Program Files\Java\jdk1.6.0_26\bin*) but it still won't work. I'm thinking of copying and pasting all my codes in a different directory but I'm afraid that the problem would still happen in the future, and changing the project's location would be too much of a hassle once the program gets really big.

In my program, I have two classes (Word and Dictionary) and a JFrame form (MainForm). Inside the Dictionary class, I have a function called testDictionary that inserts dummy data (ten Word objects) into the Dictionary object. This was running a few days ago, with no error whatsoever, but when I ran the program today, it stops on the line that says:

Word myWord = new Word();

and the java.lang.NoClassDefFoundError appears. Please help me resolve this issue, in case it appears in the future again. Thank you very much. :)

EDIT: I have already fixed this by going to

Run > Clean and Build Main Project (Shift + F11)

then I tested it again and it worked. Though I still don't know how to ACTUALLY solve the problem.


I have already fixed this by going to

Run > Clean and Build Main Project (Shift + F11)

0

精彩评论

暂无评论...
验证码 换一张
取 消