I usually start the AS in debug mode so that I can use hot swap. But how can I get that if whenever I change a configuration or java file Netbeans sends it to Glassfish and
To use the hot-swap capabilities of JPDA in a NetBeans/GlassFish environment, you need to turn off the 'Deploy on save' feature of NetBeans.
This feature can be configured on a per project basis, so it appears in the project's Properties dialog. The UI folks felt that deployment was more a part of running the project than compiling the project. The control that turns the feature on and off is in the 'Run' properties.
You may also notice that the project is running in Debug mode and the apply code changed tool is enabled. It is the icon directly under the string 'IDE' at the top of the screenshot.