Window -> Preferences -> General -> Workspace -> “Save automatically before build”
Window ->Preferences -> Run/Debug -> Launching -> “Save dirty editors before launching”