You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by "Christopher C. Lanz" <la...@potsdam.edu.INVALID> on 2023/01/25 18:47:59 UTC

no main class error: strangest fix

Hello,
I use NB 16 on Windows 10. On a very large project that has been running for years, lately, I get the "cannot find or load main class" error about once a day. Yes, removing the cache fixes it, but  so does something else:

comment out whatever code you just added or changed
run the program (it has always, then, worked at this point (so far knock on wood - about a dozen instances ))
replace the code you removed
run the program

At which point the same code now finds the main class that it couldn't before, and runs normally.
I am unable to duplicate this on a small test project - it just never gets the error in the first place.

Anybody have any suggestions for avoiding this time-wasting error?

Thanks.


Chris Lanz, Assoc. Professor Emeritus

Department of Computer Science

340 Dunn Hall, SUNY Potsdam

lanzcc@potsdam.edu

315 268 1547




Re: no main class error: strangest fix

Posted by Laszlo Kishalmi <la...@gmail.com>.
Couldn't it be that the Java Parser just got a bad day (red notification 
bubble in the bottom status bar).

Those cases the IDE loss the connection with the code and can't find 
parser assisted stuff.


It should be better with NB17 as we've fixed a few NPE-s along the way.


On 1/25/23 10:47, Christopher C. Lanz wrote:
> Hello,
> I use NB 16 on Windows 10. On a very large project that has been 
> running for years, lately, I get the "cannot find or load main class" 
> error about once a day. Yes, removing the cache fixes it, but  so does 
> something else:
>
> comment out whatever code you just added or changed
> run the program (it has always, then, worked at this point (so far 
> knock on wood - about a dozen instances ))
> replace the code you removed
> run the program
>
> At which point the same code now finds the main class that it couldn't 
> before, and runs normally.
> I am unable to duplicate this on a small test project - it just never 
> gets the error in the first place.
>
> Anybody have any suggestions for avoiding this time-wasting error?
>
> Thanks.
>
> Chris Lanz, Assoc. Professor Emeritus
>
> Department of Computer Science
>
> 340 Dunn Hall, SUNY Potsdam
>
> lanzcc@potsdam.edu
>
> 315 268 1547
>
>
>
>