We calculated the energies of the static solitary wave solutions of the one-dimensional Gross-Pitaevskii equation with the time-dependent parabolic trap, the time-dependent scattering wave length of s-wave, and the time-dependent external potential describing a gain or loss term. Some written solutions of the equation were used, two of which are based on the experimental results. The solutions satisfy the condition of solitary wave solution since they are localized over the space. By this argument, the energies were obtained by integrating the Hamiltonian density over the space formulated in the classical field theory. To do that, we constructed the appropriate Lagrangian density representing the equation by initially writing the ansatz Lagrangian density and then substituting into the Euler-Lagrange equation. We found that two of the solutions have the same energies and the other one should mathematically have the pure imaginary function describing the gain-loss term to achieve the real energy.