We have developed a tactile display that uses electric current from the skin surface as a stimulus. Our main objective was to independently stimulate a variety of mechanoreceptors and to generate specific sensations by combining stimuli. The key to this goal is selective nerve stimulation. In this paper, a mathematical framework is build for the general design of the selective stimulation. The geometries of electrodes and nerve fibers are arbitrary, and the waveform of the electric current from each electrode is independently controlled. Furthermore, the problem is formulated by linear or quadratic programming, which provides an optimal solution.