The next generation light sources such as energy recovery linac (ERL) light sources and X-ray FEL oscillator require high brightness electron gun with megahertz repetition rate. We have developed a DC photoemission gun at JAEA and demonstrated generation of a 500-keV electron beam from the gun. This demonstration was achieved by addressing a discharge problem that leads to vacuum breakdown of the DC gun. The problem is microdischarge at an anode electrode or a vacuum chamber, which is triggered by microparticle transfer or field emission from a cathode electrode. An experimental investigation has revealed that larger acceleration gap optimized to mainly reduce surface electric field of anode electrode results in suppression of the microdischarge events. The gun was transported to the compact ERL (cERL) at KEK. The commissioning of the injector system of the cERL is under way.