Java DB is installed automatically as part of the Java SE Development Kit (JDK).
To obtain the JDK, navigate your web browser to http://www.oracle.com/technetwork/java/javase/downloads/ and click the Download button for the version of the JDK you want to install. Follow the instructions on subsequent pages. To obtain the demos and sample programs for Java DB if you are using JDK 7, download and install the Demos and Samples for the JDK in addition to the JDK itself.
For a Java DB installation, set the DERBY_HOME environment variable, described in Setting the environment variables, to JAVA_HOME/db.
After you install the Demos and Samples for JDK 7, you can find the Java DB demos and samples in JAVA_HOME/demo/db.