Abigail Vo
Abigail Vo

Reputation: 103

Netbeans could not find or load main class

I have a project name JavaApplication3 and I place it in D:\\. But when I build project, the compiler said :

Error: Could not find or load main class javaapplication3.JavaApplication3.

But when I move my project to C:\\User\\Administrator it works.

What should I do to place my project to another place but it's still working?

Upvotes: 0

Views: 6990

Answers (2)

Lala
Lala

Reputation: 21

I am using Netbeans with the following specs:

Product Version: NetBeans IDE 7.0.1 (Build 201107282000) Java: 1.7.0_09; Java HotSpot(TM) Client VM 23.5-b02 System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

One can also turn off the option to automatically compile on save, then open the file you wish to run, make some tiny edit, save and recompile it.

Also I've found its a good practice to erase/delete all the temp files netbeans creates also automatically. On my system these are located in C:\temp

Upvotes: 2

d1e
d1e

Reputation: 6442

Right-click on the project node > Project Properties > Run > Select main class.

MANIFEST.MF file describes which class to consider as main class.

Upvotes: 1

Related Questions