how to calculate the dc component of an energy signal?
An energy signal $f(t)$ satisfies

$$\int_{-\infty}^{\infty}|f(t)|^2dt&lt;\infty\tag{1}$$

i.e. it has finite energy. If $f(t)$ had a non-zero DC component $f_0$ defined by

$$f_0=\lim_{T\rightarrow\infty}\frac{1}{T}\int_{-T/2}^{T/2}f(t)dt\tag{2}$$

the integral in (1) wouldn't converge. So an energy signal must have a zero DC component.

Note that there is some confusion about the term "DC component". Some people would call $F(0)$, i.e. the value of the Fourier transform of $f(t)$ at frequency $\omega=0$, the "DC component" of $f(t)$. However, note that $F(0)$ given by

$$F(0)=\int_{-\infty}^{\infty}f(t)dt\tag{3}$$

can be non-zero (but finite), even if (1) is satisfied. One example of such a signal satisfying (1) but with $F(0)\neq 0$ is a sinc pulse.

Also have a look a this answer to a related question.