On an XPiNC, a SSJS button calls a Java method defined in a managed bean (don't ask, not mine).
I alter this method. No big deal, basic Java stuff.
I clean/rebuild : the first test results in error 500. After exiting Notes and Designer, no more error, but the behaviour is as if I had made no modification. Something persists somewhere and I can't figure out what, where nor why.
This database is on a server. "Build automatically" is off.
Two weeks ago I ran into the same problem, that sort of solved itself overnight. Now I've been stuck there for a couple of days.
Building the application will delete the class files used by Domino Designer and Notes Client (the latter for XPiNC). That results in the error 500. It's standard behaviour. If you want to test changes you make for an XPiNC application, you will need to close and re-open Notes and Designer before testing each building each change (with build automatically switched off, you only update the .java files, not the .class files the application actually uses). This is why I would not recommend performing initial testing on XPiNC, but in a browser.
There were issues with updating Java in some 8.x releases. I'm not sure which version you're on.
The fact that the application is on a server is not relevant for XPiNC. By default, the application is still run locally in XPiNC, unless the "Run server-based XPages apps directly on server" option is ticked.
Because the application is on a server, I would recommend testing on a browser. That will identify if the problem is your application or XPiNC.
UPDATE
The Package Explorer will let you see the .class files, by amending the filter to include ".* resources", which can be modified as in the screenshot below.