Solution 1:

I recommend for greater ease and comfort:

sudo apt --remove purge eclipse

or

sudo apt --remove purge netbeans

and install form SNAP:

sudo snap install eclipse --classic

or

sudo snap install netbeans --classic

Solution 2:

I was getting this error:

$ sudo snap install eclipse --classic  
error: snap "eclipse" has "install-snap" change in progress

Tried for long to resolve it and finally this worked out for me:

Run command:

$ snap changes

and check if its output says "Doing", something like this:

ID   Status  Spawn               Ready  Summary
92   Doing   today at 15:17 IST  -      Install "eclipse" snap

If yes, you can just abort this by using command :

sudo snap abort 92

where, 92 is ID.

Then, if you run install command again, it works fine.

sudo snap install eclipse --classic

Hope this helps someone.