The working repository for Nashorn is at http://hg.openjdk.java.net/nashorn/jdk8, but there are routine pushes of nashorn to the jdk8 tl and master repositories.
The primary method of building Nashorn is along with the the rest of the JDK, Building The JDK. If you have the mercurial forest extension installed (forest can be found in ./common/bin or at hg clone https://bitbucket.org/gxti/hgforest), the steps are as follows;
hg fclone http://hg.openjdk.java.net/nashorn/jdk8 nashorn~jdk8
cd nashorn~jdk8
sh configure
make all
If you don't have the mercurial forest extension, follows these steps;
hg clone http://hg.openjdk.java.net/nashorn/jdk8 nashorn~jdk8
cd nashorn~jdk8
sh get_source.sh
sh configure
make all
Successive builds can be done by;
make all
The resulting build will be in the ./build directory. The organization depends on the platform. On unix/mac systems you can find the sdk image using;
find build -name "j2sdk-image/"
You can then test that image directly by;
export JAVA_HOME $PWD/build/.../j2sdk-image (or setenv JAVA_HOME $PWD/build/.../j2sdk-image)
java -fullversion
If you want to just work with the Nashorn repository against an existing JDK8 build, then you can use the ant scripts provided in the nashorn repository.
hg clone http://hg.openjdk.java.net/nashorn/jdk8/nashorn nashorn
cd nashorn
(cd make ; ant)
The result can be found at ./dist/nashorn.jar. Just include this in your class path.