A construction machine, comprising: an engine; a generator for generating an electric power by a power of the engine; an electric storage device for storing the electric power generated by the generator; a controller for storing a currently used program, and performing a rewriting process of rewriting the currently used program with a renewal program using an electric power from the electric storage device when the engine is stopped; and a charge amount detector for detecting a charge amount of the electric storage device, wherein the controller checks, before performing the rewriting process, whether the charge amount detected by the charge amount detector is smaller than a rewrite charge amount preliminarily set as a charge amount required for the rewriting process, and when the charge amount detected by the charge amount detector is smaller than the rewrite charge amount, prohibits execution of the rewriting process, the controller includes a vehicle controller for storing the currently used program, and a communication controller communicable with a server containing the renewal program via a communication means to store the renewal program transferred from the server; and the vehicle controller includes a transfer request section for requesting the communication controller to transfer the renewal program, and a rewrite section for performing the rewriting process using the renewal program transferred from the communication controller, characterized in that the vehicle controller includes a storage section for storing the renewal program, and checks, before a start of transfer of the renewal program from the communication controller to the vehicle controller, whether the charge amount detected by the charge amount detector is equal to or greater than a transfer charge amount preliminarily set as a charge amount required to transfer the renewal program from the communication controller to the vehicle controller, and when the charge amount detected by the charge amount detector is equal to or greater than the transfer charge amount, permits the transfer request section to request the transfer and causes the storage section to store the transferred renewal program, the rewrite charge amount is set to be equal to or greater than a charge amount required to rewrite the currently used program by the rewrite section; and the vehicle controller checks, before performing the rewriting process after the renewal program is transferred from the communication controller to the vehicle controller, whether the charge amount detected by the charge amount detector is smaller than the rewrite charge amount, and when the charge amount detected by the charge amount detector is smaller than the rewrite charge amount, prohibits the rewrite section from rewriting the currently used program. an engine; a generator for generating an electric power by a power of the engine; an electric storage device for storing the electric power generated by the generator; a controller for storing a currently used program, and performing a rewriting process of rewriting the currently used program with a renewal program using an electric power from the electric storage device when the engine is stopped; and a charge amount detector for detecting a charge amount of the electric storage device, wherein the controller checks, before performing the rewriting process, whether the charge amount detected by the charge amount detector is smaller than a rewrite charge amount preliminarily set as a charge amount required for the rewriting process, and when the charge amount detected by the charge amount detector is smaller than the rewrite charge amount, prohibits execution of the rewriting process, the controller includes a vehicle controller for storing the currently used program, and a communication controller communicable with a server containing the renewal program via a communication means to store the renewal program transferred from the server; and the vehicle controller includes a transfer request section for requesting the communication controller to transfer the renewal program, and a rewrite section for performing the rewriting process using the renewal program transferred from the communication controller, characterized in that the vehicle controller includes a storage section for storing the renewal program, and checks, before a start of transfer of the renewal program from the communication controller to the vehicle controller, whether the charge amount detected by the charge amount detector is equal to or greater than a transfer charge amount preliminarily set as a charge amount required to transfer the renewal program from the communication controller to the vehicle controller, and when the charge amount detected by the charge amount detector is equal to or greater than the transfer charge amount, permits the transfer request section to request the transfer and causes the storage section to store the transferred renewal program, the rewrite charge amount is set to be equal to or greater than a charge amount required to rewrite the currently used program by the rewrite section; and the vehicle controller checks, before performing the rewriting process after the renewal program is transferred from the communication controller to the vehicle controller, whether the charge amount detected by the charge amount detector is smaller than the rewrite charge amount, and when the charge amount detected by the charge amount detector is smaller than the rewrite charge amount, prohibits the rewrite section from rewriting the currently used program.