A Bosonic particle and zero mass Dirac acting on a one-dimensional barrier potential have been studied in relativistic quantum mechanics using the Dirac and Klein-Gordon equation. The equations are modified due to the influence of the electromagnetic fields and the matrix approach has been applied to obtain the representation of energy and the eigen spinor. Especially for Dirac particles, the Dirac Hamiltonian form is similar to the harmonic oscillator, so the representation of energy is an extension of the harmonic oscillator energy. In addition, the eigenfunctions involved positive energy and negative energy that moved exponentially when passed through a potential barrier.