The following Java program trains and runs a neural network, from the command line.
Neurun.jar The executable neural network file. 
Jama-1.0.1.jar Java Matrix package, from the National Institute of Standards and Technology, and MathWorks.
xorandor.txt A sample file of training data.

To train the neural network on the sample training set and run it, copy the three files above to the same directory on your computer, and type at the command line:

java -jar Neurun.jar

(or c:\full\pathname\java if needed). Read the content of the xorandor.txt file to understand how the inputs are encoded, using this neural network. You should have version 1.3 or a more recent version of the Java SDK or runtime installed.

Read the documentation for the Runner class for more command line options, and how to use other training files.
Browse the source files,, and (included in Neurun.jar).

Neural Networks

The neural networks used in practice for pattern recognition are based on what is called the error backpropagation algorithm. They map each of a set of input vectors to a corresponding output vector. A vector in this context is just a sequence of numbers of fixed length.

The program shows the neural network the output vector for each input vector, and at the end of training, the network contains the function that maps each input vector to the right output vector, to within a specified approximation. Then when it is given a vector at the input somewhat different from  the ones it was trained on, it gives an output vector defined by this internal function.

To "train" a neural network the algorithm runs each input vector  through the network, comparing the actual vector obtained at the output with the desired output vector. It uses the difference between the two to compute changes to the internal weights between the "neurons", so as to reduce that difference a little bit. This is done repeatedly until the difference is small enough, and the neural network gives approximately the desired output vector for every input vector in the training set. If we now feed the neural network an input vector slightly altered from the ones it was trained on, the network should generate a "correct" output vector. That means for example, if the neural network is classifying images of digits, then a 3 with a small blob on it should be classified as a 3. But if there are enough blobs to make it look like an 8, the network may classify it as an 8.

A good text on neural computing is Introduction to the Theory of Neural Computation, by Hertz, Krogh, and Palmer.

Some sites:

Mathematica Neural Networks toolkit, with a good tutorial.

California Scientific - a leading maker of Neural Network software.