  We compute the finite temperature Casimir energy for massive scalar field
with general curvature coupling subject to Dirichlet or Neumann boundary
conditions on the walls of a closed cylinder with arbitrary cross section,
located in a background spacetime of the form $M^{d_1+1}\times \mathcal{N}^n$,
where $M^{d_1+1}$ is the $(d_1+1)$-dimensional Minkowski spacetime and
$\mathcal{N}^n$ is an $n$-dimensional internal manifold. The Casimir energy is
regularized using the criteria that it should vanish in the infinite mass
limit. The Casimir force acting on a piston moving freely inside the closed
cylinder is derived and it is shown that it is independent of the
regularization procedure. By letting one of the chambers of the cylinder
divided by the piston to be infinitely long, we obtain the Casimir force acting
on two parallel plates embedded in the cylinder. It is shown that if both the
plates assume Dirichlet or Neumann boundary conditions, the strength of the
Casimir force is reduced by the increase in mass. Under certain conditions, the
passage from massless to massive will change the nature of the force from long
range to short range. Other properties of the Casimir force such as its sign,
its behavior at low and high temperature, and its behavior at small and large
plate separations, are found to be similar to the massless case. Explicit exact
formulas and asymptotic behaviors of the Casimir force at different limits are
derived. The Casimir force when one plate assumes Dirichlet boundary condition
and one plate assumes Neumann boundary condition is also derived and shown to
be repulsive.
