Student charged for writing violent essay