summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/language-support.xml83
-rw-r--r--nixos/modules/config/timezone.nix6
-rw-r--r--nixos/modules/system/etc/setup-etc.pl10
-rw-r--r--pkgs/applications/editors/emacs-modes/jdee/default.nix8
-rw-r--r--pkgs/applications/editors/emacs-modes/jdee/java-directory.patch6
-rw-r--r--pkgs/applications/editors/jedit/default.nix26
-rw-r--r--pkgs/applications/graphics/zgrviewer/default.nix6
-rw-r--r--pkgs/applications/networking/p2p/freenet/default.nix10
-rw-r--r--pkgs/build-support/release/ant-build.nix14
-rw-r--r--pkgs/build-support/setup-hooks/set-java-classpath.sh13
-rw-r--r--pkgs/development/compilers/closure/default.nix6
-rw-r--r--pkgs/development/compilers/openjdk/default.nix129
-rw-r--r--pkgs/development/eclipse/ecj/default.nix84
-rw-r--r--pkgs/development/interpreters/clojure/binary.nix47
-rw-r--r--pkgs/development/interpreters/clojure/clooj-wrapper.nix11
-rw-r--r--pkgs/development/interpreters/clojure/clooj.nix23
-rw-r--r--pkgs/development/interpreters/clojure/default.nix25
-rw-r--r--pkgs/development/interpreters/clojure/wrapper.nix11
-rwxr-xr-xpkgs/development/interpreters/kaffe/builder.sh5
-rw-r--r--pkgs/development/interpreters/kaffe/default.nix14
-rw-r--r--pkgs/development/libraries/java/hydra-ant-logger/default.nix23
-rw-r--r--pkgs/development/libraries/java/icedtea/default.nix114
-rw-r--r--pkgs/development/libraries/java/icedtea/nixos-slash-bin.patch20
-rw-r--r--pkgs/development/libraries/java/rhino/default.nix67
-rw-r--r--pkgs/development/libraries/java/xalanj/default.nix57
-rw-r--r--pkgs/development/libraries/java/xerces/default.nix57
-rw-r--r--pkgs/development/tools/build-managers/apache-ant/ant-contrib.nix17
-rw-r--r--pkgs/development/tools/build-managers/apache-ant/builder.sh53
-rw-r--r--pkgs/development/tools/build-managers/apache-ant/default.nix114
-rw-r--r--pkgs/development/tools/build-managers/apache-ant/from-source.nix90
-rw-r--r--pkgs/development/tools/build-managers/apache-ant/use-gcj.patch18
-rw-r--r--pkgs/development/tools/build-managers/leiningen/builder.sh8
-rw-r--r--pkgs/development/tools/build-managers/leiningen/lein_2.3.0.patch2
-rw-r--r--pkgs/development/tools/parsing/jikespg/builder.sh15
-rw-r--r--pkgs/development/tools/parsing/jikespg/default.nix15
-rwxr-xr-xpkgs/servers/sql/postgresql/jdbc/builder.sh10
-rw-r--r--pkgs/servers/sql/postgresql/jdbc/default.nix21
-rw-r--r--pkgs/tools/misc/jdiskreport/builder.sh6
-rw-r--r--pkgs/tools/misc/smc/default.nix6
-rw-r--r--pkgs/tools/typesetting/fop/default.nix20
-rw-r--r--pkgs/top-level/all-packages.nix75
-rw-r--r--pkgs/top-level/release-python.nix8
42 files changed, 465 insertions, 888 deletions
diff --git a/doc/language-support.xml b/doc/language-support.xml
index cb40be4bf57f..69361e3be6c3 100644
--- a/doc/language-support.xml
+++ b/doc/language-support.xml
@@ -112,7 +112,7 @@ file used by <filename>Makefile.PL</filename>:
 
 buildPerlPackage rec {
   name = "BerkeleyDB-0.36";
-  
+
   src = fetchurl {
     url = "mirror://cpan/authors/id/P/PM/PMQS/${name}.tar.gz";
     sha256 = "07xf50riarb60l1h6m2dqmql8q5dij619712fsgw7ach04d8g3z1";
@@ -123,7 +123,7 @@ buildPerlPackage rec {
     echo "INCLUDE = ${db4}/include" >> config.in
   '';
 }
-</programlisting>  
+</programlisting>
 
 </para>
 
@@ -233,10 +233,83 @@ twisted = buildPythonPackage {
 </section>
 
 
-<section><title>Java</title>
+<section xml:id="ssec-language-java"><title>Java</title>
+
+<para>Ant-based Java packages are typically built from source as follows:
+
+<programlisting>
+stdenv.mkDerivation {
+  name = "...";
+  src = fetchurl { ... };
+
+  buildInputs = [ jdk ant ];
+
+  buildPhase = "ant";
+}
+</programlisting>
+
+Note that <varname>jdk</varname> is an alias for the OpenJDK.</para>
+
+<para>JAR files that are intended to be used by other packages should
+be installed in <filename>$out/share/java</filename>.  The OpenJDK has
+a stdenv setup hook that adds any JARs in the
+<filename>share/java</filename> directories of the build inputs to the
+<envar>CLASSPATH</envar> environment variable.  For instance, if the
+package <literal>libfoo</literal> installs a JAR named
+<filename>foo.jar</filename> in its <filename>share/java</filename>
+directory, and another package declares the attribute
+
+<programlisting>
+buildInputs = [ jdk libfoo ];
+</programlisting>
+
+then <envar>CLASSPATH</envar> will be set to
+<filename>/nix/store/...-libfoo/share/java/foo.jar</filename>.</para>
+
+<para>Private JARs
+should be installed in a location like
+<filename>$out/share/<replaceable>package-name</replaceable></filename>.</para>
+
+<para>If your Java package provides a program, you need to generate a
+wrapper script to run it using the OpenJRE.  You can use
+<literal>makeWrapper</literal> for this:
+
+<programlisting>
+buildInputs = [ makeWrapper ];
+
+installPhase =
+  ''
+    mkdir -p $out/bin
+    makeWrapper ${jre}/bin/java $out/bin/foo \
+      --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
+  '';
+</programlisting>
+
+Note the use of <literal>jre</literal>, which is the part of the
+OpenJDK package that contains the Java Runtime Environment.  By using
+<literal>${jre}/bin/java</literal> instead of
+<literal>${jdk}/bin/java</literal>, you prevent your package from
+depending on the JDK at runtime.</para>
+
+<para>It is possible to use a different Java compiler than
+<command>javac</command> from the OpenJDK.  For instance, to use the
+Eclipse Java Compiler:
+
+<programlisting>
+buildInputs = [ jre ant ecj ];
+</programlisting>
+
+(Note that here you don’t need the full JDK as an input, but just the
+JRE.)  The ECJ has a stdenv setup hook that sets some environment
+variables to cause Ant to use ECJ, but this doesn’t work with all Ant
+files.  Similarly, you can use the GNU Java Compiler:
+
+<programlisting>
+buildInputs = [ gcj ant ];
+</programlisting>
 
-<para>Java packages should install JAR files in
-<filename>$out/lib/java</filename>.</para>
+Here, Ant will automatically use <command>gij</command> (the GNU Java
+Runtime) instead of the OpenJRE.</para>
 
 </section>
 
diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix
index 07a76d9ad1fa..42fbe841d070 100644
--- a/nixos/modules/config/timezone.nix
+++ b/nixos/modules/config/timezone.nix
@@ -25,9 +25,11 @@ with pkgs.lib;
   config = {
 
     environment.variables.TZDIR = "/etc/zoneinfo";
-    environment.variables.TZ = config.time.timeZone;
 
-    environment.etc.localtime.source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";
+    environment.etc.localtime =
+      { source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";
+        mode = "direct-symlink";
+      };
 
     environment.etc.zoneinfo.source = "${pkgs.tzdata}/share/zoneinfo";
 
diff --git a/nixos/modules/system/etc/setup-etc.pl b/nixos/modules/system/etc/setup-etc.pl
index 7cb6d2a6a45e..4b79dbaab89e 100644
--- a/nixos/modules/system/etc/setup-etc.pl
+++ b/nixos/modules/system/etc/setup-etc.pl
@@ -57,9 +57,13 @@ sub link {
         open MODE, "<$_.mode";
         my $mode = <MODE>; chomp $mode;
         close MODE;
-        copy "$static/$fn", "$target.tmp" or warn;
-        chmod oct($mode), "$target.tmp" or warn;
-        rename "$target.tmp", $target or warn;
+        if ($mode eq "direct-symlink") {
+            atomicSymlink readlink("$static/$fn"), $target or warn;
+        } else {
+            copy "$static/$fn", "$target.tmp" or warn;
+            chmod oct($mode), "$target.tmp" or warn;
+            rename "$target.tmp", $target or warn;
+        }
     } elsif (-l "$_") {
         atomicSymlink "$static/$fn", $target or warn;
     }
diff --git a/pkgs/applications/editors/emacs-modes/jdee/default.nix b/pkgs/applications/editors/emacs-modes/jdee/default.nix
index b25d178d1648..89d908826b1c 100644
--- a/pkgs/applications/editors/emacs-modes/jdee/default.nix
+++ b/pkgs/applications/editors/emacs-modes/jdee/default.nix
@@ -26,8 +26,8 @@ in
       mkdir -p "dist"
       cat > build.properties <<EOF
         dist.lisp.dir = dist/share/emacs/site-lisp
-        dist.java.lib.dir = dist/lib/java
-        dist.jar.jde.file = dist/lib/java/jde.jar
+        dist.java.lib.dir = dist/share/java
+        dist.jar.jde.file = dist/share/java/jde.jar
         dist.java.src.dir = dist/src/${name}/java
         dist.doc.dir  dist/doc/${name}
         prefix.dir = $out
@@ -40,7 +40,7 @@ in
       for i in "lisp/"*.el
       do
         sed -i "$i" -e "s|@out@|$out|g ;
-                        s|@javadir@|$out/lib/java|g ;
+                        s|@javadir@|$out/share/java|g ;
                         s|@datadir@|$out/share/${name}|g"
       done
     '';
@@ -55,7 +55,7 @@ in
 
       # Move everything that's not a JAR to $datadir.  This includes
       # `sun_checks.xml', license files, etc.
-      cd "$out/lib/java"
+      cd "$out/share/java"
       for i in *
       do
         if echo $i | grep -qv '\.jar''$'
diff --git a/pkgs/applications/editors/emacs-modes/jdee/java-directory.patch b/pkgs/applications/editors/emacs-modes/jdee/java-directory.patch
index 53aa8edc6eaa..ec03749daa67 100644
--- a/pkgs/applications/editors/emacs-modes/jdee/java-directory.patch
+++ b/pkgs/applications/editors/emacs-modes/jdee/java-directory.patch
@@ -14,7 +14,7 @@ Tell the elisp code about the right Java directory.
 -    (oset this bsh-cmd-dir (expand-file-name "bsh-commands" jde-java-directory))
 -    (oset this checkstyle-jar  (expand-file-name "lib/checkstyle-all.jar" jde-java-directory))
 -    (oset this regexp-jar (expand-file-name "lib/jakarta-regexp.jar" jde-java-directory))
-+  (let ((jde-java-directory "@out@/lib/java"))
++  (let ((jde-java-directory "@out@/share/java"))
 +
 +    (oset this bsh-cmd-dir "@datadir@/bsh-commands")
 +    (oset this checkstyle-jar  (expand-file-name "checkstyle-all.jar" jde-java-directory))
@@ -38,7 +38,7 @@ Tell the elisp code about the right Java directory.
 -	  (concat
 -	   (jde-find-jde-data-directory)
 -	   "java/"))
-+	 (jde-java-directory "@out@/lib/java")
++	 (jde-java-directory "@out@/share/java")
  	 (args (append
  		(unless jde-checkstyle-expanded-properties-file
  		  (jde-checkstyle-get-property-args this))
@@ -67,7 +67,7 @@ Tell the elisp code about the right Java directory.
 -	     (jde-java-directory
 -	      (expand-file-name "java"
 -	       (jde-find-jde-data-directory)))
-+	     (jde-java-directory "@out@/lib/java")
++	     (jde-java-directory "@out@/share/java")
  	     (vm-args 
  		(let (args)
  		  (setq args 
diff --git a/pkgs/applications/editors/jedit/default.nix b/pkgs/applications/editors/jedit/default.nix
index efaf719c7c47..8a57f650fb4a 100644
--- a/pkgs/applications/editors/jedit/default.nix
+++ b/pkgs/applications/editors/jedit/default.nix
@@ -1,20 +1,20 @@
-{ stdenv, fetchurl, ant, jre }:
+{ stdenv, fetchurl, ant, jdk }:
+
+let version = "4.4.2"; in
 
 stdenv.mkDerivation {
-  name = "jedit-4.4.2";
+  name = "jedit-${version}";
 
   src = fetchurl {
-    url = mirror://sourceforge/jedit/jedit4.4.2source.tar.bz2;
+    url = "mirror://sourceforge/jedit/jedit${version}source.tar.bz2";
     sha256 = "5e9ad9c32871b77ef0b9fe46dcfcea57ec52558d36113b7280194a33430b8ceb";
   };
 
-  setSourceRoot = ''
-    sourceRoot=jEdit
-  '';
+  buildInputs = [ ant jdk ];
 
-  buildPhase = ''
-     ant build
-  '';
+  sourceRoot = "jEdit";
+
+  buildPhase = "ant build";
 
   installPhase = ''
     mkdir -p $out/share/jEdit
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
     cp -r macros/* $out/share/jEdit/macros
     mkdir -p $out/share/jEdit/doc
     cp -r doc/* $out/share/jEdit/doc
-    
+
     sed -i "s|Icon=.*|Icon=$out/share/jEdit/icons/jedit-icon48.png|g" package-files/linux/deb/jedit.desktop
     mkdir -p $out/share/applications
     mv package-files/linux/deb/jedit.desktop $out/share/applications/jedit.desktop
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
     patch package-files/linux/jedit << EOF
     5a6,8
     > # specify the correct JAVA_HOME
-    > JAVA_HOME=${jre}
+    > JAVA_HOME=${jdk.jre}/lib/openjdk/jre
     > 
     EOF
     sed -i "s|/usr/share/jEdit/@jar.filename@|$out/share/jEdit/jedit.jar|g" package-files/linux/jedit
@@ -44,9 +44,7 @@ stdenv.mkDerivation {
     chmod +x $out/bin/jedit
   '';
 
-  buildInputs = [ ant ];
-
-  meta = { 
+  meta = {
     description = "Mature programmer's text editor (Java based)";
     homepage = http://www.jedit.org;
     license = "GPL";
diff --git a/pkgs/applications/graphics/zgrviewer/default.nix b/pkgs/applications/graphics/zgrviewer/default.nix
index 93d1b28854a6..4eefd5749b65 100644
--- a/pkgs/applications/graphics/zgrviewer/default.nix
+++ b/pkgs/applications/graphics/zgrviewer/default.nix
@@ -10,14 +10,14 @@ stdenv.mkDerivation rec {
   buildInputs = [jre unzip];
   buildPhase = "";
   installPhase = ''
-    mkdir -p "$out"/{bin,lib/java/zvtm/plugins,share/doc/zvtm}
+    mkdir -p "$out"/{bin,share/java/zvtm/plugins,share/doc/zvtm}
 
     cp overview.html *.license.* "$out/share/doc/zvtm"
 
-    cp -r target/* "$out/lib/java/zvtm/"
+    cp -r target/* "$out/share/java/zvtm/"
 
     echo '#!/bin/sh' > "$out/bin/zgrviewer"
-    echo "java -jar '$out/lib/java/zvtm/zgrviewer-${version}.jar'" >> "$out/bin/zgrviewer"
+    echo "java -jar '$out/share/java/zvtm/zgrviewer-${version}.jar'" >> "$out/bin/zgrviewer"
     chmod a+x "$out/bin/zgrviewer"
   '';
   meta = {
diff --git a/pkgs/applications/networking/p2p/freenet/default.nix b/pkgs/applications/networking/p2p/freenet/default.nix
index 67037a071327..4c74c2c32de0 100644
--- a/pkgs/applications/networking/p2p/freenet/default.nix
+++ b/pkgs/applications/networking/p2p/freenet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, apacheAntOpenJDK, jre }:
+{ stdenv, fetchurl, ant, jdk }:
 
 let
   # The .gitmodules in freenet-official-20130413-eccc9b3198
@@ -14,7 +14,7 @@ let
   };
 in
 stdenv.mkDerivation {
-  name = "freenet-official-20130413-eccc9b3198";
+  name = "freenet-20130413-eccc9b3198";
 
   src = fetchurl {
     url = https://github.com/freenet/fred-official/tarball/eccc9b3198;
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
     sed '/antcall.*-ext/d' -i build.xml
   '';
 
-  buildInputs = [ apacheAntOpenJDK jre ];
+  buildInputs = [ ant jdk ];
 
   buildPhase = "ant package-only";
 
@@ -41,13 +41,13 @@ stdenv.mkDerivation {
 
     cat <<EOF > $out/bin/freenet
     #!${stdenv.shell}
-    ${jre}/bin/java -cp $out/share/freenet/bcprov.jar:$out/share/freenet/freenet-ext.jar:$out/share/freenet/freenet.jar \\
+    ${jdk.jre}/bin/java -cp $out/share/freenet/bcprov.jar:$out/share/freenet/freenet-ext.jar:$out/share/freenet/freenet.jar \\
       -Xmx1024M freenet.node.NodeStarter
     EOF
     chmod +x $out/bin/freenet
   '';
 
-  meta = { 
+  meta = {
     description = "Decentralised and censorship-resistant network";
     homepage = https://freenetproject.org/;
     license = "GPLv2+";
diff --git a/pkgs/build-support/release/ant-build.nix b/pkgs/build-support/release/ant-build.nix
index 0cabdf2f7e79..1ca3c65d3f25 100644
--- a/pkgs/build-support/release/ant-build.nix
+++ b/pkgs/build-support/release/ant-build.nix
@@ -8,7 +8,7 @@
 , antProperties ? []
 , antBuildInputs ? []
 , buildfile ? "build.xml"
-, ant ? pkgs.apacheAntOpenJDK
+, ant ? pkgs.ant
 , jre ? pkgs.openjdk
 , hydraAntLogger ? pkgs.hydraAntLogger
 , ... } @ args:
@@ -31,7 +31,7 @@ stdenv.mkDerivation (
 
     antSetupPhase = with stdenv.lib; ''
       if test "$hydraAntLogger" != "" ; then
-        export ANT_ARGS="-logger org.hydra.ant.HydraLogger -lib `ls $hydraAntLogger/lib/java/*.jar | head -1`"
+        export ANT_ARGS="-logger org.hydra.ant.HydraLogger -lib `ls $hydraAntLogger/share/java/*.jar | head -1`"
       fi
       for abi in ${concatStringsSep " " (map (f: "`find ${f} -name '*.jar'`") antBuildInputs)}; do
         export ANT_ARGS="$ANT_ARGS -lib $abi"
@@ -39,20 +39,20 @@ stdenv.mkDerivation (
     '';
 
     installPhase = ''
-      mkdir -p $out/lib/java
+      mkdir -p $out/share/java
       ${ if jars == [] then '' 
-           find . -name "*.jar" | xargs -I{} cp -v {} $out/lib/java
+           find . -name "*.jar" | xargs -I{} cp -v {} $out/share/java
          '' else stdenv.lib.concatMapStrings (j: ''
-           cp -v ${j} $out/lib/java
+           cp -v ${j} $out/share/java
          '') jars }
-      for j in $out/lib/java/*.jar ; do
+      for j in $out/share/java/*.jar ; do
         echo file jar $j >> $out/nix-support/hydra-build-products
       done
     '';
 
     generateWrappersPhase = 
       let 
-        cp = w: "-cp '${lib.optionalString (w ? classPath) w.classPath}${lib.optionalString (w ? mainClass) ":$out/lib/java/*"}'";
+        cp = w: "-cp '${lib.optionalString (w ? classPath) w.classPath}${lib.optionalString (w ? mainClass) ":$out/share/java/*"}'";
       in
       '' 
       header "Generating jar wrappers"
diff --git a/pkgs/build-support/setup-hooks/set-java-classpath.sh b/pkgs/build-support/setup-hooks/set-java-classpath.sh
new file mode 100644
index 000000000000..76e8e42ca268
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/set-java-classpath.sh
@@ -0,0 +1,13 @@
+# This setup hook adds every JAR in the share/java subdirectories of
+# the build inputs to $CLASSPATH.
+
+export CLASSPATH
+
+addPkgToClassPath () {
+    local jar
+    for jar in $1/share/java/*.jar; do
+        export CLASSPATH=''${CLASSPATH}''${CLASSPATH:+:}''${jar}
+    done
+}
+
+envHooks=(''${envHooks[@]} addPkgToClassPath)
diff --git a/pkgs/development/compilers/closure/default.nix b/pkgs/development/compilers/closure/default.nix
index 13c9f1c03505..428346b78b6b 100644
--- a/pkgs/development/compilers/closure/default.nix
+++ b/pkgs/development/compilers/closure/default.nix
@@ -14,11 +14,11 @@ stdenv.mkDerivation rec {
   buildInputs = [ gnutar ];
 
   installPhase = ''
-    mkdir -p $out/lib/java $out/bin
+    mkdir -p $out/share/java $out/bin
     tar -xzf $src
-    cp -r compiler.jar $out/lib/java/
+    cp -r compiler.jar $out/share/java/
     echo "#!${bash}/bin/bash" > $out/bin/closure-compiler
-    echo "${jre}/bin/java -jar $out/lib/java/compiler.jar \"\$@\"" >> $out/bin/closure-compiler
+    echo "${jre}/bin/java -jar $out/share/java/compiler.jar \"\$@\"" >> $out/bin/closure-compiler
     chmod +x $out/bin/closure-compiler
   '';
 
diff --git a/pkgs/development/compilers/openjdk/default.nix b/pkgs/development/compilers/openjdk/default.nix
index fd229cf5b139..b99139c0e3fe 100644
--- a/pkgs/development/compilers/openjdk/default.nix
+++ b/pkgs/development/compilers/openjdk/default.nix
@@ -1,30 +1,6 @@
-{ stdenv
-, fetchurl
-, unzip
-, zip
-, procps
-, coreutils
-, alsaLib
-, ant
-, freetype
-, cups
-, which
-, jdk
-, nettools
-, libX11
-, libXt
-, libXext
-, libXrender
-, libXtst
-, libXi
-, libXinerama
-, libXcursor
-, fontconfig
-, cpio
-, cacert
-, jreOnly ? false
-, perl
-}:
+{ stdenv, fetchurl, unzip, zip, procps, coreutils, alsaLib, ant, freetype, cups
+, which, jdk, nettools, libX11, libXt, libXext, libXrender, libXtst, libXi, libXinerama
+, libXcursor, fontconfig, cpio, cacert, perl, setJavaClassPath }:
 
 let
 
@@ -46,35 +22,20 @@ let
 in
 
 stdenv.mkDerivation rec {
-  name = "openj${if jreOnly then "re" else "dk"}-7u${update}b${build}";
+  name = "openjdk-7u${update}b${build}";
 
   src = fetchurl {
     url = http://www.java.net/download/openjdk/jdk7u40/promoted/b43/openjdk-7u40-fcs-src-b43-26_aug_2013.zip;
     sha256 = "15h5nmbw6yn5596ccakqdbs0vd8hmslsfg5sfk8wmjvn31bfmy00";
   };
 
-  #  outputs = [ "out" ] ++ stdenv.lib.optionals (! jreOnly) [ "jre" ];
-
-  buildInputs = [
-    unzip
-    procps
-    ant
-    which
-    zip
-    cpio
-    nettools
-    alsaLib
-    libX11
-    libXt
-    libXext
-    libXrender
-    libXtst
-    libXi
-    libXinerama
-    libXcursor
-    fontconfig
-    perl
-  ];
+  outputs = [ "out" "jre" ];
+
+  buildInputs =
+    [ unzip procps ant which zip cpio nettools alsaLib
+      libX11 libXt libXext libXrender libXtst libXi libXinerama libXcursor
+      fontconfig perl
+    ];
 
   NIX_LDFLAGS = "-lfontconfig -lXcursor -lXinerama";
 
@@ -85,13 +46,12 @@ stdenv.mkDerivation rec {
 
     sed -i "s@/bin/echo -e@${coreutils}/bin/echo -e@" \
       openjdk/{jdk,corba}/make/common/shared/Defs-utils.gmk
-
-    sed -i "s@<Xrender.h>@<X11/extensions/Xrender.h>@" \
-      openjdk/jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c
   '';
 
   patches = [ ./cppflags-include-fix.patch ];
 
+  NIX_NO_SELF_RPATH = true;
+
   makeFlags = [
     "SORT=${coreutils}/bin/sort"
     "ALSA_INCLUDE=${alsaLib}/include/alsa/version.h"
@@ -108,43 +68,68 @@ stdenv.mkDerivation rec {
     "UNLIMITED_CRYPTO=1"
   ];
 
-  configurePhase = ''
-    make $makeFlags sanity
-  '';
+  configurePhase = "true";
 
   installPhase = ''
-    mkdir -p $out
-    cp -av build/*/j2${if jreOnly then "re" else "sdk"}-image/* $out
+    mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk
+
+    cp -av build/*/j2sdk-image/* $out/lib/openjdk
+
+    # Move some stuff to top-level.
+    mv $out/lib/openjdk/include $out/include
+    mv $out/lib/openjdk/man $out/share/man
 
     # Remove some broken manpages.
     rm -rf $out/share/man/ja*
 
     # Remove crap from the installation.
-    rm -rf $out/demo $out/sample
+    rm -rf $out/lib/openjdk/demo $out/lib/openjdk/sample
+
+    # Move the JRE to a separate output.
+    mv $out/lib/openjdk/jre $jre/lib/openjdk/
+    ln -s $jre/lib/openjdk/jre $out/lib/openjdk/jre
+
+    # Remove duplicate binaries.
+    for i in $(cd $out/lib/openjdk/bin && echo *); do
+      if cmp -s $out/lib/openjdk/bin/$i $jre/lib/openjdk/jre/bin/$i; then
+        ln -sfn $jre/lib/openjdk/jre/bin/$i $out/lib/openjdk/bin/$i
+      fi
+    done
 
     # Generate certificates.
-    pushd $out/${if ! jreOnly then "jre/" else ""}lib/security
+    pushd $jre/lib/openjdk/jre/lib/security
     rm cacerts
-    perl ${./generate-cacerts.pl} $out/bin/keytool ${cacert}/etc/ca-bundle.crt
+    perl ${./generate-cacerts.pl} $jre/lib/openjdk/jre/bin/keytool ${cacert}/etc/ca-bundle.crt
     popd
+
+    ln -s $out/lib/openjdk/bin $out/bin
+    ln -s $jre/lib/openjdk/jre/bin $jre/bin
+  ''; # */
+
+  # FIXME: this is unnecessary once the multiple-outputs branch is merged.
+  preFixup = ''
+    prefix=$jre stripDirs "$stripDebugList" "''${stripDebugFlags:--S}"
+    patchELF $jre
+    propagatedNativeBuildInputs+=" $jre"
+
+    # Propagate the setJavaClassPath setup hook from the JRE so that
+    # any package that depends on the JRE has $CLASSPATH set up
+    # properly.
+    mkdir -p $jre/nix-support
+    echo -n "${setJavaClassPath}" > $jre/nix-support/propagated-native-build-inputs
+
+    # Set JAVA_HOME automatically.
+    mkdir -p $out/nix-support
+    cat <<EOF > $out/nix-support/setup-hook
+    if [ -n "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
+    EOF
   '';
-#  '' + (if jreOnly then "" else ''
-#    if [ -z $jre ]; then
-#      exit 0
-#    fi
-#    mkdir -p $jre
-#    cp -av build/*/j2re-image/* $jre
-#  '');
 
   meta = {
     homepage = http://openjdk.java.net/;
-
     license = "GPLv2";
-
     description = "The open-source Java Development Kit";
-
     maintainers = [ stdenv.lib.maintainers.shlevy ];
-
     platforms = stdenv.lib.platforms.linux;
   };
 
diff --git a/pkgs/development/eclipse/ecj/default.nix b/pkgs/development/eclipse/ecj/default.nix
index ba3e643a4fea..786fcdba18a8 100644
--- a/pkgs/development/eclipse/ecj/default.nix
+++ b/pkgs/development/eclipse/ecj/default.nix
@@ -1,59 +1,59 @@
-{ stdenv, fetchurl, unzip, ant, gcj }:
+{ stdenv, fetchurl, unzip, ant, jdk, makeWrapper }:
 
 let
   version = "3.7.2";
   date    = "201202080800";
-  isGCJ   = stdenv.lib.strings.substring 0 3 gcj.name == "gcj";
-  javaExec  = if isGCJ then "gij" else "java";
-  javaFlags = if isGCJ then "--cp" else "-cp";
 in
-  stdenv.mkDerivation rec {
-    name = "ecj-${version}";
 
-    src = fetchurl {
-      url = "http://eclipse.ialto.org/eclipse/downloads/drops/R-${version}-${date}/ecjsrc-${version}.jar";
-      sha256 = "0swyysbyfmv068x8q1c5jqpwk5zb4xahg17aypx5rwb660f8fpbm";
-    };
+stdenv.mkDerivation rec {
+  name = "ecj-${version}";
 
-    buildInputs = [ unzip ant gcj ];
+  src = fetchurl {
+    url = "http://eclipse.ialto.org/eclipse/downloads/drops/R-${version}-${date}/ecjsrc-${version}.jar";
+    sha256 = "0swyysbyfmv068x8q1c5jqpwk5zb4xahg17aypx5rwb660f8fpbm";
+  };
 
-    unpackPhase = ''
-      mkdir "${name}"
-      cd "${name}"
-      unzip "$src"
-    '';
+  buildInputs = [ unzip ant jdk makeWrapper ];
 
-    # Use whatever compiler Ant knows.
-    buildPhase = "ant build";
+  unpackPhase = ''
+    mkdir "${name}"
+    cd "${name}"
+    unzip "$src"
+  '';
 
-    installPhase = ''
-      mkdir -pv "$out/lib/java"
-      cp -v *.jar "$out/lib/java"
+  # Use whatever compiler Ant knows.
+  buildPhase = "ant build";
 
-      mkdir -pv "$out/bin"
-      cat > "$out/bin/ecj" <<EOF
-#! /bin/sh
-exec "$(type -P ${javaExec})" ${javaFlags} "$out/lib/java/ecj.jar" org.eclipse.jdt.internal.compiler.batch.Main \$@
-EOF
+  installPhase = ''
+    mkdir -pv $out/share/java
+    cp -v *.jar $out/share/java
 
-      chmod u+x "$out/bin/ecj"
-    '';
+    mkdir -pv $out/bin
+    makeWrapper ${jdk.jre}/bin/java $out/bin/ecj \
+      --add-flags "-cp $out/share/java/ecj.jar org.eclipse.jdt.internal.compiler.batch.Main"
 
-    meta = {
-      description = "The Eclipse Compiler for Java (ECJ)";
+    # Add a setup hook that causes Ant to use the ECJ.
+    mkdir -p $out/nix-support
+    cat <<EOF > $out/nix-support/setup-hook
+    export NIX_ANT_ARGS="-Dbuild.compiler=org.eclipse.jdt.core.JDTCompilerAdapter \$NIX_ANT_ARGS"
+    EOF
+  '';
 
-      longDescription = ''
-        ECJ is an incremental Java compiler.  Implemented as an Eclipse
-        builder, it is based on technology evolved from VisualAge for Java
-        compiler.  In particular, it allows users to run and debug code which
-        still contains unresolved errors.
-      '';
+  meta = {
+    description = "The Eclipse Compiler for Java (ECJ)";
+
+    longDescription = ''
+      ECJ is an incremental Java compiler.  Implemented as an Eclipse
+      builder, it is based on technology evolved from VisualAge for Java
+      compiler.  In particular, it allows users to run and debug code which
+      still contains unresolved errors.
+    '';
 
-      homepage = http://www.eclipse.org/jdt/core/index.php;
+    homepage = http://www.eclipse.org/jdt/core/index.php;
 
-      # http://www.eclipse.org/legal/epl-v10.html (free software, copyleft)
-      license = "EPLv1.0";
+    # http://www.eclipse.org/legal/epl-v10.html (free software, copyleft)
+    license = "EPLv1.0";
 
-      maintainers = [ ];
-    };
-  }
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/development/interpreters/clojure/binary.nix b/pkgs/development/interpreters/clojure/binary.nix
deleted file mode 100644
index 1678a9323799..000000000000
--- a/pkgs/development/interpreters/clojure/binary.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-{stdenv, fetchurl, unzip}:
-
-stdenv.mkDerivation rec {
-  version = "1.5.1";
-  name = "clojure-binary-${version}";
-
-  src = fetchurl {
-    url = "http://repo1.maven.org/maven2/org/clojure/clojure/${version}/clojure-${version}.zip";
-    sha256 = "1qgiji6ddvv40khp3qb3xfz09g7p4nnsh3pywqglb9f16v534yzy";
-  };
-
-
-  buildInputs = [ unzip ];
-
-  phases = "unpackPhase installPhase";
-
-  installPhase = "
-    mkdir -p $out/lib/java
-    cp clojure-${version}.jar clojure.jar
-    install -t $out/lib/java clojure.jar
-  ";
-
-  meta = {
-    description = "a Lisp dialect for the JVM";
-    homepage = http://clojure.org/;
-    license = stdenv.lib.licenses.bsd3;
-    longDescription = ''
-      Clojure is a dynamic programming language that targets the Java
-      Virtual Machine. It is designed to be a general-purpose language,
-      combining the approachability and interactive development of a
-      scripting language with an efficient and robust infrastructure for
-      multithreaded programming. Clojure is a compiled language - it
-      compiles directly to JVM bytecode, yet remains completely
-      dynamic. Every feature supported by Clojure is supported at
-      runtime. Clojure provides easy access to the Java frameworks, with
-      optional type hints and type inference, to ensure that calls to Java
-      can avoid reflection.
-
-      Clojure is a dialect of Lisp, and shares with Lisp the code-as-data
-      philosophy and a powerful macro system. Clojure is predominantly a
-      functional programming language, and features a rich set of immutable,
-      persistent data structures. When mutable state is needed, Clojure
-      offers a software transactional memory system and reactive Agent
-      system that ensure clean, correct, multithreaded designs.
-    '';
-  };
-}
diff --git a/pkgs/development/interpreters/clojure/clooj-wrapper.nix b/pkgs/development/interpreters/clojure/clooj-wrapper.nix
deleted file mode 100644
index fd95b86451fe..000000000000
--- a/pkgs/development/interpreters/clojure/clooj-wrapper.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{writeTextFile, jre, clooj}:
-
-writeTextFile {
-  name = "clooj-wrapper";
-  executable = true;
-  destination = "/bin/clooj";
-  text = ''
-    #!/bin/sh
-    exec ${jre}/bin/java -jar ${clooj}/lib/java/clooj.jar
-  '';
-}
diff --git a/pkgs/development/interpreters/clojure/clooj.nix b/pkgs/development/interpreters/clojure/clooj.nix
index 2ad6f751f2bd..c1e104458302 100644
--- a/pkgs/development/interpreters/clojure/clooj.nix
+++ b/pkgs/development/interpreters/clojure/clooj.nix
@@ -1,24 +1,27 @@
-{stdenv, fetchurl}:
+{ stdenv, fetchurl, jre, makeWrapper }:
+
+let version = "0.4.4"; in
+
+stdenv.mkDerivation {
+  name = "clooj-${version}";
 
-let
   jar = fetchurl {
-    url = https://github.com/downloads/arthuredelstein/clooj/clooj-0.1.36-STANDALONE.jar;
-    sha256 = "173c66c0aade3ae5d21622f629e60efa51a03ad83c087b02c25e806c5b7f838c";
+    url = "http://www.mediafire.com/download/prkf64humftrmz3/clooj-${version}-standalone.jar";
+    sha256 = "0hbc29bg2a86rm3sx9kvj7h7db9j0kbnrb706wsfiyk3zi3bavnd";
   };
-in
 
-stdenv.mkDerivation {
-  name = "clooj-0.1.32";
+  buildInputs = [ makeWrapper ];
 
   phases = "installPhase";
 
   installPhase = ''
-    mkdir -p $out/lib/java
-    ln -s ${jar} $out/lib/java/clooj.jar
+    mkdir -p $out/share/java
+    ln -s $jar $out/share/java/clooj.jar
+    makeWrapper ${jre}/bin/java $out/bin/clooj --add-flags "-jar $out/share/java/clooj.jar"
   '';
 
   meta = {
-    description = "clooj, a lightweight IDE for clojure";
+    description = "A lightweight IDE for Clojure";
     homepage = https://github.com/arthuredelstein/clooj;
     license = stdenv.lib.licenses.bsd3;
   };
diff --git a/pkgs/development/interpreters/clojure/default.nix b/pkgs/development/interpreters/clojure/default.nix
index dbbe4a9dcc31..6db652572a3a 100644
--- a/pkgs/development/interpreters/clojure/default.nix
+++ b/pkgs/development/interpreters/clojure/default.nix
@@ -1,30 +1,27 @@
-{stdenv, fetchurl, unzip, ant, version ? "1.4.0" }:
+{ stdenv, fetchurl, unzip, ant, jdk, makeWrapper }:
+
+let version = "1.5.1"; in
 
-let 
-  src_hashes = {
-    "1.4.0" = "27a5a151d5cc1bc3e52dff47c66111e637fefeb42d9bedfa1284a1a31d080171";
-    "1.5.0-RC1" = "111jm0nxkvqr1vrwcpvr70v5paasp8msrj5h8zm1c144c8zc1vln";
-  };
-in 
 stdenv.mkDerivation {
   name = "clojure-${version}";
 
   src = fetchurl {
     url = "http://repo1.maven.org/maven2/org/clojure/clojure/${version}/clojure-${version}.zip";
-    sha256 = (builtins.getAttr version src_hashes); 
+    sha256 = "1qgiji6ddvv40khp3qb3xfz09g7p4nnsh3pywqglb9f16v534yzy";
   };
 
-  buildInputs = [ unzip ant ];
+  buildInputs = [ unzip ant jdk makeWrapper ];
 
   buildPhase = "ant jar";
 
-  installPhase = "
-    mkdir -p $out/lib/java
-    install -t $out/lib/java clojure.jar
-  ";
+  installPhase = ''
+    mkdir -p $out/share/java $out/bin
+    install -t $out/share/java clojure.jar
+    makeWrapper ${jdk.jre}/bin/java $out/bin/clojure --add-flags "-cp $out/share/java/clojure.jar clojure.main"
+  '';
 
   meta = {
-    description = "a Lisp dialect for the JVM";
+    description = "A Lisp dialect for the JVM";
     homepage = http://clojure.org/;
     license = stdenv.lib.licenses.bsd3;
     longDescription = ''
diff --git a/pkgs/development/interpreters/clojure/wrapper.nix b/pkgs/development/interpreters/clojure/wrapper.nix
deleted file mode 100644
index a2a9a4044621..000000000000
--- a/pkgs/development/interpreters/clojure/wrapper.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{writeTextFile, jre, clojure}:
-
-writeTextFile {
-  name = "clojure-wrapper";
-  executable = true;
-  destination = "/bin/clojure";
-  text = ''
-    #!/bin/sh
-    exec ${jre}/bin/java -cp ${clojure}/lib/java/clojure.jar clojure.main
-  '';
-}
\ No newline at end of file
diff --git a/pkgs/development/interpreters/kaffe/builder.sh b/pkgs/development/interpreters/kaffe/builder.sh
deleted file mode 100755
index 823a8ebff0ec..000000000000
--- a/pkgs/development/interpreters/kaffe/builder.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-source $stdenv/setup || exit 1
-
-configureFlags="--with-jikes=$jikes/bin/jikes --enable-pure-java-math"
-genericBuild
-
diff --git a/pkgs/development/interpreters/kaffe/default.nix b/pkgs/development/interpreters/kaffe/default.nix
deleted file mode 100644
index 6f7ba6c18e9d..000000000000
--- a/pkgs/development/interpreters/kaffe/default.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{stdenv, fetchurl, alsaLib, xlibs, jikes}:
-
-stdenv.mkDerivation {
-  name = "kaffe-1.1.4";
-  builder = ./builder.sh;
-  src = fetchurl {
-    url = ftp://ftp.kaffe.org/pub/kaffe/v1.1.x-development/kaffe-1.1.4.tar.gz;
-    md5 = "94d6e7035ba68c2221dce68bb5b3f6e9";
-  };
-  inherit jikes alsaLib;
-  inherit (xlibs) libXaw libX11;
-
-  buildInputs = [jikes alsaLib xlibs.libXaw xlibs.libX11];
-}
diff --git a/pkgs/development/libraries/java/hydra-ant-logger/default.nix b/pkgs/development/libraries/java/hydra-ant-logger/default.nix
index 1439c6101ab9..c54c3f3a8ee8 100644
--- a/pkgs/development/libraries/java/hydra-ant-logger/default.nix
+++ b/pkgs/development/libraries/java/hydra-ant-logger/default.nix
@@ -1,24 +1,21 @@
-{ fetchsvn, stdenv, ant }:
+{ fetchgit, stdenv, ant, jdk }:
 
 stdenv.mkDerivation rec {
   name = "hydra-ant-logger-${version}";
   version = "2010.2";
 
-  src = fetchsvn {
-    url = https://svn.nixos.org/repos/nix/hydra-ant-logger/trunk;
-    rev = 20396;
-    sha256 = "1lp5zy80m4y2kq222q2x052ys5mlhgc7y4kxh2bl48744f1fkgyr";
+  src = fetchgit {
+    url = https://github.com/NixOS/hydra-ant-logger.git;
+    rev = "dae3224f4ed42418d3492bdf5bee4f825819006f";
+    sha256 = "01s7m6007rn9107rw5wcgna7i20x6p6kfzl4f79jrvpkjy6kz176";
   };
 
-  buildInputs = [ ant ];
+  buildInputs = [ ant jdk ];
 
-  buildPhase = ''
-    ln -s ${ant}/lib/ant.jar lib/ant.jar
-    ant 
-  '';
+  buildPhase = "mkdir lib; ant";
 
-  installPhase = '' 
-    mkdir -p "$out/lib/java"
-    cp -v *.jar "$out/lib/java"
+  installPhase = ''
+    mkdir -p $out/share/java
+    cp -v *.jar $out/share/java
   '';
 }
diff --git a/pkgs/development/libraries/java/icedtea/default.nix b/pkgs/development/libraries/java/icedtea/default.nix
deleted file mode 100644
index 094e2a10f950..000000000000
--- a/pkgs/development/libraries/java/icedtea/default.nix
+++ /dev/null
@@ -1,114 +0,0 @@
-/* XXX: This is work in progress and it needs your help!  */
-
-/* See http://icedtea.classpath.org/wiki/BuildRequirements for a
-   list of dependencies.  */
-
-{ fetchurl, stdenv, which
-, wget, cpio, file, ecj, gcj, ant, gawk, procps, inetutils, zip, unzip, zlib
-, alsaLib, cups, lesstif, freetype, classpath, libjpeg, libpng, giflib
-, xalanj, xerces, rhino
-, libX11, libXp, libXtst, libXinerama, libXt, libXrender, xproto
-, pkgconfig, xulrunner, pulseaudio }:
-
-let
-  # These variables must match those in the top-level `Makefile.am'.
-  openjdkVersion   = "b16";
-  openjdkDate      = "24_apr_2009";
-  openjdkURL       =
-    "http://download.java.net/openjdk/jdk6/promoted/${openjdkVersion}/";
-  openjdkSourceZip = "openjdk-6-src-${openjdkVersion}-${openjdkDate}.tar.gz";
-
-  openjdk          = fetchurl {
-    url = "${openjdkURL}${openjdkSourceZip}";
-    sha256 = "084lkhsnj29finb6pmvrh83nqbliwv32gdi5q5sv43dpv24r85cn";
-  };
-
-  hotspot          = fetchurl {
-    url = "http://hg.openjdk.java.net/hsx/hsx14/master/archive/09f7962b8b44.tar.gz";
-    sha256 = "1jbd9ki5ip96293mv1qil20yqcgvkmcrhs302j0n8i8f3v1j70bf";
-  };
-
-in
-
-stdenv.mkDerivation rec {
-  name = "icedtea6-1.6.1";
-
-  src = fetchurl {
-    url = "http://icedtea.classpath.org/download/source/${name}.tar.gz";
-    sha256 = "11vaanfmz842x576wrw5qldpkksi8wqjmh9wikn5gxyjk87qq3k5";
-  };
-
-  buildInputs = [
-    wget  # Not actually used, thanks to `--with-openjdk-src-zip' et al.
-    which cpio file ecj gcj ant gawk procps inetutils zip unzip zlib
-    alsaLib cups lesstif freetype classpath libjpeg libpng giflib
-    xalanj xerces
-    libX11 libXp libXtst libXinerama libXt libXrender xproto
-    pkgconfig /* xulrunner */ pulseaudio
-  ];
-
-  preConfigure =
-    '' # Use the Sun-compatible tools (`jar', etc.).
-       export PATH="${gcj.gcc}/lib/jvm/bin:$PATH"
-
-       # Copy patches.
-       cp -v "${./nixos-slash-bin.patch}" patches/nixos-slash-bin.patch
-    '';
-
-  configureFlags =
-    stdenv.lib.concatStringsSep " "
-      [ "--with-gcj-home=${gcj}"
-        "--with-ecj" "--with-ecj-jar=${ecj}/lib/java/ecj.jar"
-        "--with-openjdk-src-zip=${openjdk}"
-        "--with-hotspot-src-zip=${hotspot}"
-        "--with-ant-home=${ant}/lib/java"
-        "--with-xalan2-jar=${xalanj}/lib/java/xalan.jar"
-        "--with-xalan2-serializer-jar=${xalanj}/lib/java/xalan.jar"
-        "--with-xerces2-jar=${xerces}/lib/java/xercesImpl.jar"
-        "--with-rhino=${rhino}/lib/java/js.jar"
-        "--disable-plugin" # FIXME: Enable it someday.
-
-        "--with-parallel-job"
-      ];
-
-  makeFlags =
-    [ # Have OpenCDK use tools from $PATH.
-      "ALT_UNIXCCS_PATH=" "ALT_UNIXCOMMAND_PATH=" "ALT_USRBIN_PATH="
-      "ALT_COMPILER_PATH=" "ALT_DEVTOOLS_PATH="
-
-      # Libraries.
-      "ALT_MOTIF_DIR="
-      "ALT_FREETYPE_HEADERS_PATH=${freetype}/include"
-      "ALT_FREETYPE_LIB_PATH=${freetype}/lib"
-      "ALT_CUPS_HEADERS_PATH=${cups}/include"
-      "ALT_CUPS_LIB_PATH=${cups}/lib"
-
-      # Tell IcedTea about our patches.
-      "DISTRIBUTION_PATCHES=patches/nixos-slash-bin.patch"
-    ];
-
-  meta = {
-    description = "IcedTea, a libre Java development kit based on OpenJDK";
-
-    longDescription =
-      '' The IcedTea project provides a harness to build the source code from
-         http://openjdk.java.net using Free Software build tools and adds a
-         number of key features to the upstream OpenJDK codebase: a Free
-         64-bit plugin with LiveConnect and Java Web Start support, support
-         for additional platforms via a pure interpreted mode in HotSpot
-         (Zero) or the alternative CACAO virtual machine.  Experimental JIT
-         support for Zero is also available via Shark.
-      '';
-
-    license = "GPLv2"; /* and multiple-licensing, e.g., for the plug-ins */
-
-    homepage = http://icedtea.classpath.org/;
-
-    maintainers = [ ];
-
-    # Restrict to GNU systems for now.
-    platforms = stdenv.lib.platforms.gnu;
-
-    broken = true;
-  };
-}
diff --git a/pkgs/development/libraries/java/icedtea/nixos-slash-bin.patch b/pkgs/development/libraries/java/icedtea/nixos-slash-bin.patch
deleted file mode 100644
index df4d1f4d03f9..000000000000
--- a/pkgs/development/libraries/java/icedtea/nixos-slash-bin.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Remove references to /bin/echo to allow NixOS builds.
-
---- openjdk/jdk/make/common/shared/Defs-utils.gmk	2009-04-24 09:33:55.000000000 +0200
-+++ openjdk/jdk/make/common/shared/Defs-utils.gmk	2010-01-19 15:39:29.000000000 +0100
-@@ -177,7 +177,7 @@ ifeq ($(PLATFORM),linux)
- 
-   NAWK           = $(USRBIN_PATH)gawk
-   # Intrinsic unix command, with backslash-escaped character interpretation
--  ECHO           = /bin/echo -e
-+  ECHO           = echo -e
-   # These are really in UTILS_USR_BIN_PATH on Linux (only sccs is not)
-   AR             = $(UTILS_USR_BIN_PATH)ar
-   AS             = $(UTILS_USR_BIN_PATH)as
-@@ -195,6 +195,6 @@ ifeq ($(PLATFORM),solaris)
-   # Intrinsic unix command, with backslash-escaped character interpretation
-   #   (not using -e  will cause build failure when using /bin/bash)
-   #   (using -e breaks something else)
--  ECHO           = /usr/bin/echo
-+  ECHO           = echo
- endif
diff --git a/pkgs/development/libraries/java/rhino/default.nix b/pkgs/development/libraries/java/rhino/default.nix
index a61ea5e60452..ec19e381281d 100644
--- a/pkgs/development/libraries/java/rhino/default.nix
+++ b/pkgs/development/libraries/java/rhino/default.nix
@@ -9,48 +9,49 @@ let
     sha256 = "1pb08d9j81d0wz5wj31idz198iwhqb7mch872n08jh1354rjlqwk";
   };
 in
-  stdenv.mkDerivation {
-    name = "rhino-${version}";
 
-    src = fetchurl {
-      url = "ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip";
-      sha256 = "1p32hkghi6bkc3cf2dcqyaw5cjj7403mykcp0fy8f5bsnv0pszv7";
-    };
+stdenv.mkDerivation {
+  name = "rhino-${version}";
 
-    patches = [ ./gcj-type-mismatch.patch ];
+  src = fetchurl {
+    url = "ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip";
+    sha256 = "1p32hkghi6bkc3cf2dcqyaw5cjj7403mykcp0fy8f5bsnv0pszv7";
+  };
 
-    preConfigure =
-      '' find -name \*.jar -or -name \*.class -exec rm -v {} \;
+  patches = [ ./gcj-type-mismatch.patch ];
 
-         # The build process tries to download it by itself.
-         mkdir -p "build/tmp-xbean"
-         ln -sv "${xbeans}" "build/tmp-xbean/xbean.zip"
-      '';
+  preConfigure =
+    ''
+      find -name \*.jar -or -name \*.class -exec rm -v {} \;
 
-    buildInputs = [ unzip ant javac jvm ];
+      # The build process tries to download it by itself.
+      mkdir -p "build/tmp-xbean"
+      ln -sv "${xbeans}" "build/tmp-xbean/xbean.zip"
+    '';
 
-    buildPhase = "ant ${options} jar";
-    doCheck    = false;
+  buildInputs = [ unzip ant javac jvm ];
 
-    # FIXME: Install javadoc as well.
-    installPhase =
-      '' mkdir -p "$out/lib/java"
-         cp -v *.jar "$out/lib/java"
-      '';
+  buildPhase = "ant ${options} jar";
+  doCheck    = false;
 
-    meta = {
-      description = "Mozilla Rhino: JavaScript for Java";
+  # FIXME: Install javadoc as well.
+  installPhase =
+    ''
+      mkdir -p "$out/share/java"
+      cp -v *.jar "$out/share/java"
+    '';
 
-      longDescription =
-        '' Rhino is an open-source implementation of JavaScript written
-           entirely in Java.  It is typically embedded into Java applications
-           to provide scripting to end users.
-        '';
+  meta = {
+    description = "Mozilla Rhino: JavaScript for Java";
 
-      homepage = http://www.mozilla.org/rhino/;
+    longDescription =
+      '' Rhino is an open-source implementation of JavaScript written
+         entirely in Java.  It is typically embedded into Java applications
+         to provide scripting to end users.
+      '';
 
-      licenses = [ "MPLv1.1" /* or */ "GPLv2+" ];
+    homepage = http://www.mozilla.org/rhino/;
 
-      maintainers = [ ];
-    };
-  }
+    licenses = [ "MPLv1.1" /* or */ "GPLv2+" ];
+  };
+}
diff --git a/pkgs/development/libraries/java/xalanj/default.nix b/pkgs/development/libraries/java/xalanj/default.nix
deleted file mode 100644
index c5ffed50be1b..000000000000
--- a/pkgs/development/libraries/java/xalanj/default.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{ fetchurl, stdenv, ant, javac, jvm, xerces }:
-
-let
-  version = "2.7.1";
-  options = "-Dbuild.compiler=gcj";   # FIXME: We assume GCJ here.
-in
-  stdenv.mkDerivation {
-    name = "xalan-j-${version}";
-
-    src = fetchurl {
-      url = "mirror://apache/xml/xalan-j/source/xalan-j_2_7_1-src.tar.gz";
-      sha256 = "0hxhx0n0ynflq1d01sma658ipwn3f3902x6n8mfk70mqkdiallps";
-    };
-
-    buildInputs = [ ant javac jvm xerces ];
-
-    configurePhase =
-      '' rm -v lib/xerces*.jar
-         export CLASSPATH="${xerces}/lib/java"
-      '';
-
-    buildPhase = "ant ${options} jar";
-    doCheck    = false;
-
-    # FIXME: Install javadoc as well.
-    installPhase =
-      '' mkdir -p "$out/lib/java"
-         cp -v build/x*.jar "$out/lib/java"
-      '';
-
-    meta = {
-      description = "Apache Xalan-Java, an XSLT processor";
-
-      longDescription =
-        '' Xalan-Java is an XSLT processor for transforming XML documents
-           into HTML, text, or other XML document types.  It implements XSL
-           Transformations (XSLT) Version 1.0 and XML Path Language (XPath)
-           Version 1.0 and can be used from the command line, in an applet or a
-           servlet, or as a module in other program.
-
-           Xalan-Java implements the javax.xml.transform interface in Java
-           API for XML Processing (JAXP) 1.3.  This interface provides a
-           modular framework and a standard API for performing XML
-           transformations, and utilizes system properties to determine which
-           Transformer and which XML parser to use.
-
-           Xalan-Java also implements the javax.xml.xpath interface in JAXP
-           1.3, which provides an object-model neutral API for evaluation of
-           XPath expressions and access to the evaluation environment.
-        '';
-
-      homepage = http://xml.apache.org/xalan-j/;
-      license = "Apache-2.0";
-
-      maintainers = [ ];
-    };
-  }
diff --git a/pkgs/development/libraries/java/xerces/default.nix b/pkgs/development/libraries/java/xerces/default.nix
deleted file mode 100644
index ed46747dbb20..000000000000
--- a/pkgs/development/libraries/java/xerces/default.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{ fetchurl, stdenv, ant, javac, jvm }:
-
-let
-  version = "2.9.1";
-  tools   = fetchurl {
-    url = "mirror://apache/xerces/j/source/Xerces-J-tools.${version}.tar.gz";
-    sha256 = "1zzbq9ijy0f3v8w2sws9w79bkda34m9i01993md94n8fccnkiwac";
-  };
-  options = "-Dbuild.compiler=gcj";   # FIXME: We assume GCJ here.
-in
-  stdenv.mkDerivation {
-    name = "xerces-j-${version}";
-
-    src = fetchurl {
-      url = "mirror://apache/xerces/j/source/Xerces-J-src.${version}.tar.gz";
-      sha256 = "14h5jp58999f0rg4mkyab015hkgsxa8n6cx53ia0sjialxi01bqk";
-    };
-
-    buildInputs = [ ant javac jvm ];
-
-    configurePhase = "tar xzvf ${tools}";
-    buildPhase     = "ant ${options} jar";
-
-    # The `tests' directory is missing from the tarball.
-    doCheck = false;
-
-    # FIXME: Install javadoc as well.
-    installPhase =
-      '' mkdir -p "$out/lib/java"
-         cp -v build/xerces*.jar "$out/lib/java"
-      '';
-
-    meta = {
-      description = "Apache Xerces, an XML parser for Java";
-
-      longDescription =
-        '' Xerces2 Java is a library for parsing, validating and manipulating
-           XML documents.
-
-           Xerces 2.x introduced the Xerces Native Interface (XNI), a
-           complete framework for building parser components and
-           configurations that is extremely modular and easy to program.  XNI
-           is merely an internal set of interfaces.  There is no need for an
-           XML application programmer to learn XNI if they only intend to
-           interface to the Xerces2 parser using standard interfaces like
-           JAXP, DOM, and SAX.  Xerces developers and application developers
-           that need more power and flexibility than that provided by the
-           standard interfaces should read and understand XNI.
-        '';
-
-      homepage = http://xerces.apache.org/xerces2-j/;
-
-      license = "Apache-2.0";
-
-      maintainers = [ ];
-    };
-  }
diff --git a/pkgs/development/tools/build-managers/apache-ant/ant-contrib.nix b/pkgs/development/tools/build-managers/apache-ant/ant-contrib.nix
deleted file mode 100644
index ca61f43c7385..000000000000
--- a/pkgs/development/tools/build-managers/apache-ant/ant-contrib.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-args: with args;
-
-stdenv.mkDerivation {
-  name = "ant-contrib-1.0b3";
-
-  installPhase = ''
-    mkdir -p $out
-    mv ant-contrib*.jar $out/
-  '';
-
-  phases = "unpackPhase installPhase";
-
-  src = fetchurl {
-    url = mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2;
-    sha256 = "96effcca2581c1ab42a4828c770b48d54852edf9e71cefc9ed2ffd6590571ad1";
-  };
-}
diff --git a/pkgs/development/tools/build-managers/apache-ant/builder.sh b/pkgs/development/tools/build-managers/apache-ant/builder.sh
deleted file mode 100644
index 68aa89d475e8..000000000000
--- a/pkgs/development/tools/build-managers/apache-ant/builder.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-source $stdenv/setup
-
-tar jxf $src || exit 1
-mkdir -p $out
-
-mv apache-ant-*/* $out || exit 1
-
-# add ant-contrib
-cp $antContrib/*.jar $out/lib
-
-# remove crap in the root directory
-
-for file in $out/*
-do
-  if test -f $file ; then
-    rm $file
-  fi
-done
-rm -rf $out/docs
-
-# prevent the use of hacky scripts. This will be handled in Nix.
-rm $out/bin/* || exit 1
-
-# add ant script. This script is to be invoked with all
-# appropiate variables and will try to be clever or user-friendly.
-
-cat >> $out/bin/ant <<EOF
-#! /bin/sh
-
-export JAVA_HOME=$jdk
-export JAVACMD=$jdk/bin/java
-export LANG="en_US"
-
-export ANT_HOME=$out
- 
-if [ -z "\$LOCALCLASSPATH" ] ; then
-    LOCALCLASSPATH=\$ANT_HOME/lib/ant-launcher.jar
-else
-    LOCALCLASSPATH=\$ANT_HOME/lib/ant-launcher.jar:\$LOCALCLASSPATH
-fi
-
-if [ -n "\$JIKESPATH" ]; then
-  exec "\$JAVACMD" \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" -Dant.home="\${ANT_HOME}" -Djikes.class.path="\$JIKESPATH" org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS -lib "$CLASSPATH" "\$@"
-else
-  exec "\$JAVACMD" \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" -Dant.home="\${ANT_HOME}" org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS -lib "$CLASSPATH" "\$@"
-  fi
-fi
-EOF
-
-chmod a+x $out/bin/ant
-
-ln -s $out/bin/ant $out/bin/antRun
-
diff --git a/pkgs/development/tools/build-managers/apache-ant/default.nix b/pkgs/development/tools/build-managers/apache-ant/default.nix
index c14e09e25b7f..19c664c2ea7e 100644
--- a/pkgs/development/tools/build-managers/apache-ant/default.nix
+++ b/pkgs/development/tools/build-managers/apache-ant/default.nix
@@ -1,30 +1,110 @@
-{ fetchurl, stdenv, jdk }:
+{ fetchurl, stdenv, makeWrapper }:
 
-let
+let version = "1.9.3"; in
 
-  antContrib = import ./ant-contrib.nix {
-    inherit fetchurl stdenv;
+stdenv.mkDerivation {
+  name = "ant-${version}";
+
+  buildInputs = [ makeWrapper ];
+
+  src = fetchurl {
+    url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
+    sha1 = "efcf206e24b0dd1583c501182ad163af277951a4";
   };
 
-  version = "1.8.4";
+  contrib = fetchurl {
+    url = mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2;
+    sha256 = "96effcca2581c1ab42a4828c770b48d54852edf9e71cefc9ed2ffd6590571ad1";
+  };
 
-in
+  installPhase =
+    ''
+      mkdir -p $out/bin $out/lib/ant
+      mv * $out/lib/ant/
 
-stdenv.mkDerivation {
-  name = "ant-${(builtins.parseDrvName jdk.name).name}-${version}";
+      # Get rid of the manual (35 MiB).  Maybe we should put this in a
+      # separate output.  Also get rid of the Ant scripts since we
+      # provide our own.
+      rm -rf $out/lib/ant/{manual,bin,WHATSNEW}
 
-  builder = ./builder.sh;
-  
-  buildInputs = [ antContrib jdk ];
+      # Install ant-contrib.
+      unpackFile $contrib
+      cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
 
-  inherit antContrib jdk;
+      cat >> $out/bin/ant <<EOF
+      #! ${stdenv.shell} -e
 
-  src = fetchurl {
-    url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
-    sha1 = "d9e3e83dd9664cfe1dcd4841c082db3f559af922";
-  };
+      ANT_HOME=$out/lib/ant
+
+      # Find the JDK by looking for javac.  As a fall-back, find the
+      # JRE by looking for java.  The latter allows just the JRE to be
+      # used with (say) ECJ as the compiler.  Finally, allow the GNU
+      # JVM.
+      if [ -z "\$JAVA_HOME" ]; then
+          for i in javac java gij; do
+              if p="\$(type -p \$i)"; then
+                  export JAVA_HOME="\$(dirname \$(dirname \$(readlink -f \$p)))"
+                  break
+              fi
+          done
+          if [ -z "\$JAVA_HOME" ]; then
+              echo "\$0: cannot find the JDK or JRE" >&2
+              exit 1
+          fi
+      fi
+
+      if [ -z \$NIX_JVM ]; then
+          if [ -e \$JAVA_HOME/bin/java ]; then
+              NIX_JVM=\$JAVA_HOME/bin/java
+          elif [ -e \$JAVA_HOME/bin/gij ]; then
+              NIX_JVM=\$JAVA_HOME/bin/gij
+          else
+              NIX_JVM=java
+          fi
+      fi
+
+      LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
+
+      if [ -e \$JAVA_HOME/lib/tools.jar ]; then
+          LOCALCLASSPATH="\$JAVA_HOME/lib/tools.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
+      fi
+
+      exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
+          -Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \
+          org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \
+          -cp "\$CLASSPATH" "\$@"
+      EOF
+
+      chmod +x $out/bin/ant
+    ''; # */
 
   meta = {
-    description = "Java-based build tool";
+    homepage = http://ant.apache.org/;
+    description = "A Java-based build tool";
+
+    longDescription = ''
+      Apache Ant is a Java-based build tool.  In theory, it is kind of like
+      Make, but without Make's wrinkles.
+
+      Why another build tool when there is already make, gnumake, nmake, jam,
+      and others? Because all those tools have limitations that Ant's
+      original author couldn't live with when developing software across
+      multiple platforms.  Make-like tools are inherently shell-based -- they
+      evaluate a set of dependencies, then execute commands not unlike what
+      you would issue in a shell.  This means that you can easily extend
+      these tools by using or writing any program for the OS that you are
+      working on.  However, this also means that you limit yourself to the
+      OS, or at least the OS type such as Unix, that you are working on.
+
+      Ant is different.  Instead of a model where it is extended with
+      shell-based commands, Ant is extended using Java classes.  Instead of
+      writing shell commands, the configuration files are XML-based, calling
+      out a target tree where various tasks get executed.  Each task is run
+      by an object that implements a particular Task interface.
+    '';
+
+    license = stdenv.lib.licenses.asl20;
+    maintainers = [ stdenv.lib.maintainers.eelco ];
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/tools/build-managers/apache-ant/from-source.nix b/pkgs/development/tools/build-managers/apache-ant/from-source.nix
deleted file mode 100644
index 14213415ff84..000000000000
--- a/pkgs/development/tools/build-managers/apache-ant/from-source.nix
+++ /dev/null
@@ -1,90 +0,0 @@
-{ stdenv, fetchurl, gcj, junit }:
-
-let version = "1.7.1"; in
-
-/* TODO: Once we have Icedtea, use this Nix expression to build Ant with
-   Sun's javac.  */
-
-stdenv.mkDerivation {
-  name = "ant-gcj-${version}";
-
-  src = fetchurl {
-    url = "mirror://apache/ant/source/apache-ant-${version}-src.tar.bz2";
-    sha256 = "19pvqvgkxgpgsqm4lvbki5sm0z84kxmykdqicvfad47gc1r9mi2d";
-  };
-
-  patches = [ ./use-gcj.patch ];
-
-  buildInputs = [ gcj junit ];
-
-  configurePhase = ''
-    mkdir -p "tool-aliases/bin"
-    cd "tool-aliases/bin"
-    cat > javac <<EOF
-#!/bin/sh
-opts="-C"
-echo 'running \`gcj '"\$opts \$@'..."
-exec "$(type -P gcj)" \$opts \$@
-EOF
-    chmod +x javac
-    ln -sv $(type -P gij) java
-    export PATH="$PWD:$PATH"
-
-    cd ../..
-    export JAVA_HOME="$PWD/tool-aliases"
-
-    # Make JUnit visible.
-    export CLASSPATH="$(find ${junit} -name \*.jar -printf "%p:")"
-  '';
-
-  # Note: We don't build the javadoc.
-  buildPhase = ''
-    mkdir -p "$out"
-    ./build.sh -Dant.install="$out" install-lite
-  '';
-
-  installPhase = ''
-    # Actually, everything is already installed at this point, so we just
-    # rearrange a few things.
-    rm -v "$out/bin/"*.bat
-
-    mkdir -p "$out/lib/java"
-    mv -v "$out/lib/"*.jar "$out/lib/java"
-    sed -i "$out/bin/ant" \
-        -e "s|^ANT_LIB=.*$|ANT_LIB=$out/lib/java|g ;
-            s|JAVACMD=java.*$|JAVACMD=${gcj}/lib/jvm/bin/java|g ;
-            /^ant_exec_command/i export ANT_HOME=$out"
-  '';
-
-  meta = {
-    description = "Java-based build tool";
-
-    longDescription = ''
-      Apache Ant is a Java-based build tool.  In theory, it is kind of like
-      Make, but without Make's wrinkles.
-
-      Why another build tool when there is already make, gnumake, nmake, jam,
-      and others? Because all those tools have limitations that Ant's
-      original author couldn't live with when developing software across
-      multiple platforms.  Make-like tools are inherently shell-based -- they
-      evaluate a set of dependencies, then execute commands not unlike what
-      you would issue in a shell.  This means that you can easily extend
-      these tools by using or writing any program for the OS that you are
-      working on.  However, this also means that you limit yourself to the
-      OS, or at least the OS type such as Unix, that you are working on.
-
-      Ant is different.  Instead of a model where it is extended with
-      shell-based commands, Ant is extended using Java classes.  Instead of
-      writing shell commands, the configuration files are XML-based, calling
-      out a target tree where various tasks get executed.  Each task is run
-      by an object that implements a particular Task interface.
-    '';
-
-    homepage = http://ant.apache.org/;
-
-    license = "APLv2";
-
-    maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
-  };
-}
diff --git a/pkgs/development/tools/build-managers/apache-ant/use-gcj.patch b/pkgs/development/tools/build-managers/apache-ant/use-gcj.patch
deleted file mode 100644
index db82d3ba689e..000000000000
--- a/pkgs/development/tools/build-managers/apache-ant/use-gcj.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Setting `java.compiler' or `build.compiler' in `build.properties' isn't enough.
-
---- apache-ant-1.7.1/build.xml	2008-06-27 07:05:23.000000000 +0200
-+++ apache-ant-1.7.1/build.xml	2009-09-24 15:10:53.000000000 +0200
-@@ -578,12 +578,7 @@
-       classname="com.jcraft.jsch.Session"
-       classpathref="classpath"/>
- 
--    <condition property="build.compiler" value="classic">
--      <not>
--        <isset property="jdk1.3+"/>
--      </not>
--    </condition>
--    <property name="build.compiler" value="modern"/>
-+    <property name="build.compiler" value="gcj"/>
- 
-     <!--check for XSD support in the parser-->
-     <condition property="xmlschema.present">
diff --git a/pkgs/development/tools/build-managers/leiningen/builder.sh b/pkgs/development/tools/build-managers/leiningen/builder.sh
index 8d0924028cc8..6a66466506cb 100644
--- a/pkgs/development/tools/build-managers/leiningen/builder.sh
+++ b/pkgs/development/tools/build-managers/leiningen/builder.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
-set -e
-
 source $stdenv/setup
 
-mkdir -pv $out/bin $out/lib
+mkdir -pv $out/bin $out/share/java
 
 out_bin=$out/bin/lein
 
 cp -v $src $out_bin
-cp -v $jarsrc $out/lib
-cp -v $clojure/lib/java/* $out/lib
+cp -v $jarsrc $out/share/java
+cp -v $clojure/share/java/* $out/share/java/
 
 for p in $patches;
 do
diff --git a/pkgs/development/tools/build-managers/leiningen/lein_2.3.0.patch b/pkgs/development/tools/build-managers/leiningen/lein_2.3.0.patch
index 23f6b6247764..f7d5bc4d9a7e 100644
--- a/pkgs/development/tools/build-managers/leiningen/lein_2.3.0.patch
+++ b/pkgs/development/tools/build-managers/leiningen/lein_2.3.0.patch
@@ -1,4 +1,4 @@
 46c47
 < LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
 ---
-> LEIN_JAR=$(find $(dirname $0)/../lib -name *-standalone.jar | head -n 1)
+> LEIN_JAR=$(find $(dirname $0)/../share/java -name *-standalone.jar | head -n 1)
diff --git a/pkgs/development/tools/parsing/jikespg/builder.sh b/pkgs/development/tools/parsing/jikespg/builder.sh
deleted file mode 100644
index e63ec9808f23..000000000000
--- a/pkgs/development/tools/parsing/jikespg/builder.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-source $stdenv/setup
-
-set -e
-
-configurePhase() {
-  tar zxvf $src 
-  cd jikespg/src
-}
-
-installPhase() {
-  mkdir -p $out/bin
-  cp jikespg $out/bin
-}
-
-genericBuild
diff --git a/pkgs/development/tools/parsing/jikespg/default.nix b/pkgs/development/tools/parsing/jikespg/default.nix
index 290e9a3a0033..ea66204d9cd5 100644
--- a/pkgs/development/tools/parsing/jikespg/default.nix
+++ b/pkgs/development/tools/parsing/jikespg/default.nix
@@ -2,9 +2,22 @@
 
 stdenv.mkDerivation {
   name = "jikespg-1.3";
-  builder = ./builder.sh;
+
   src = fetchurl {
     url = mirror://sourceforge/jikes/jikespg-1.3.tar.gz;
     md5 = "eba183713d9ae61a887211be80eeb21f";
   };
+
+  sourceRoot = "jikespg/src";
+
+  installPhase =
+    ''
+      mkdir -p $out/bin
+      cp jikespg $out/bin
+    '';
+
+  meta = {
+    homepage = http://jikes.sourceforge.net/;
+    description = "The Jikes Parser Generator";
+  };
 }
diff --git a/pkgs/servers/sql/postgresql/jdbc/builder.sh b/pkgs/servers/sql/postgresql/jdbc/builder.sh
deleted file mode 100755
index 2fccb6866290..000000000000
--- a/pkgs/servers/sql/postgresql/jdbc/builder.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-source $stdenv/setup
-
-set -e
-
-tar zxvf $src
-cd postgresql-jdbc-*
-ant
-
-mkdir -p $out/share/java
-cp jars/*.jar $out/share/java
diff --git a/pkgs/servers/sql/postgresql/jdbc/default.nix b/pkgs/servers/sql/postgresql/jdbc/default.nix
index e490a14bea61..61b12164f245 100644
--- a/pkgs/servers/sql/postgresql/jdbc/default.nix
+++ b/pkgs/servers/sql/postgresql/jdbc/default.nix
@@ -1,15 +1,24 @@
-{ stdenv, fetchurl, ant }:
+{ stdenv, fetchurl, ant, jdk }:
+
+let version = "9.3-1100"; in
 
 stdenv.mkDerivation rec {
-  name = "postgresql-jdbc-9.1-902";
-  builder = ./builder.sh;
+  name = "postgresql-jdbc-${version}";
 
   src = fetchurl {
-    url = "http://jdbc.postgresql.org/download/${name}.src.tar.gz";
-    sha256 = "0sgwbiw5vfxcl0g1yzsndgxdha74cr8ag6y65i0jhgg5g8qc56bz";
+    url = "http://jdbc.postgresql.org/download/postgresql-jdbc-${version}.src.tar.gz";
+    sha256 = "0mbdzhzg4ws0i7ps98rg0q5n68lsrdm2klj7y7skaix0rpa57gp6";
   };
 
-  buildInputs = [ant];
+  buildInputs = [ ant jdk ];
+
+  buildPhase = "ant";
+
+  installPhase =
+    ''
+      mkdir -p $out/share/java
+      cp jars/*.jar $out/share/java
+    '';
 
   meta = {
     homepage = http://jdbc.postgresql.org/;
diff --git a/pkgs/tools/misc/jdiskreport/builder.sh b/pkgs/tools/misc/jdiskreport/builder.sh
index cdc5f94bde0c..f95dafedd32a 100644
--- a/pkgs/tools/misc/jdiskreport/builder.sh
+++ b/pkgs/tools/misc/jdiskreport/builder.sh
@@ -4,12 +4,12 @@ unzip $src
 
 jar=$(ls */*.jar)
 
-mkdir -p $out/lib/java
-mv $jar $out/lib/java
+mkdir -p $out/share/java
+mv $jar $out/share/java
 
 mkdir -p $out/bin
 cat > $out/bin/jdiskreport <<EOF
 #! $SHELL -e
-exec $jre/bin/java -jar $out/lib/java/$(basename $jar)
+exec $jre/bin/java -jar $out/share/java/$(basename $jar)
 EOF
 chmod +x $out/bin/jdiskreport
diff --git a/pkgs/tools/misc/smc/default.nix b/pkgs/tools/misc/smc/default.nix
index a12a40e8ed71..c7c389a3733f 100644
--- a/pkgs/tools/misc/smc/default.nix
+++ b/pkgs/tools/misc/smc/default.nix
@@ -14,16 +14,16 @@ stdenv.mkDerivation rec {
     mkdir -p "$out/share/smc"
     mkdir -p "$out/share/smc/lib"
     mkdir -p "$out/share/icons"
-    mkdir -p "$out/lib/java"
+    mkdir -p "$out/share/java"
 
-    cp bin/Smc.jar "$out/lib/java/"
+    cp bin/Smc.jar "$out/share/java/"
     cp -r examples/ docs/ tools/ README.txt LICENSE.txt "$out/share/smc/"
     cp -r lib/* "$out/share/smc/lib/"
     cp misc/smc.ico "$out/share/icons/"
 
     cat > "$out/bin/smc" << EOF
     #!${stdenv.shell}
-    ${jre}/bin/java -jar "$out/lib/java/Smc.jar" "\$@"
+    ${jre}/bin/java -jar "$out/share/java/Smc.jar" "\$@"
     EOF
     chmod a+x "$out/bin/smc"
   '';
diff --git a/pkgs/tools/typesetting/fop/default.nix b/pkgs/tools/typesetting/fop/default.nix
index bc4486ed49cf..473b23fe2627 100644
--- a/pkgs/tools/typesetting/fop/default.nix
+++ b/pkgs/tools/typesetting/fop/default.nix
@@ -4,34 +4,28 @@ stdenv.mkDerivation rec {
   name = "fop-1.1";
 
   src = fetchurl {
-    url = "http://apache.uib.no/xmlgraphics/fop/source/${name}-src.tar.gz";
+    url = "mirror://apache/xmlgraphics/fop/source/${name}-src.tar.gz";
     sha256 = "08i56d57w5dl5bqchr34x9165hvi5h4bhiflxhi0a4wd56rlq5jq";
   };
 
   buildInputs = [ ant jdk ];
 
-  buildPhase = ''
-    ant
-  '';
+  buildPhase = "ant";
 
   installPhase = ''
-    mkdir -p "$out/bin"
-    mkdir -p "$out/lib"
-    mkdir -p "$out/share/doc/fop"
+    mkdir -p $out/bin $out/lib $out/share/doc/fop
 
-    cp build/*.jar lib/*.jar "$out/lib/"
-    cp -r README examples/ "$out/share/doc/fop/"
+    cp build/*.jar lib/*.jar $out/lib/
+    cp -r README examples/ $out/share/doc/fop/
 
     # There is a fop script in the source archive, but it has many impurities.
     # Instead of patching out 90 % of the script, we write our own.
     cat > "$out/bin/fop" <<EOF
     #!${stdenv.shell}
     java_exec_args="-Djava.awt.headless=true"
-    # Note the wildcard; it will be passed to java and java will expand it
-    LOCALCLASSPATH="$out/lib/*"
-    exec "${jdk}/bin/java" \$java_exec_args -classpath "\$LOCALCLASSPATH" org.apache.fop.cli.Main "\$@"
+    exec ${jdk.jre}/bin/java \$java_exec_args -classpath "$out/lib/*" org.apache.fop.cli.Main "\$@"
     EOF
-    chmod a+x "$out/bin/fop"
+    chmod a+x $out/bin/fop
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f27fb717aae0..662027059c85 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -392,6 +392,8 @@ let
 
   platforms = import ./platforms.nix;
 
+  setJavaClassPath = makeSetupHook { } ../build-support/setup-hooks/set-java-classpath.sh;
+
 
   ### TOOLS
 
@@ -407,7 +409,7 @@ let
 
   aegisub = callPackage ../applications/video/aegisub {
     wxGTK = wxGTK29;
-    lua = lua5_1; 
+    lua = lua5_1;
   };
 
   aespipe = callPackage ../tools/security/aespipe { };
@@ -2856,19 +2858,12 @@ let
       callPackage ../development/compilers/openjdk-darwin { }
     else
       let
-        openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix {};
-        openjdkStage1 = callPackage ../development/compilers/openjdk {
-          jdk = openjdkBootstrap;
-          ant = pkgs.ant.override { jdk = openjdkBootstrap; };
-        };
+        openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix { };
       in callPackage ../development/compilers/openjdk {
-        jdk = openjdkStage1;
-        ant = pkgs.ant.override { jdk = openjdkStage1; };
+        jdk = openjdkBootstrap;
       };
 
-  openjre = pkgs.openjdk.override {
-    jreOnly = true;
-  };
+  openjre = pkgs.openjdk.jre;
 
   jdk = if stdenv.isDarwin || stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"
     then pkgs.openjdk
@@ -3222,19 +3217,7 @@ let
 
   clojure = callPackage ../development/interpreters/clojure { };
 
-  clojureUnstable = callPackage ../development/interpreters/clojure { version = "1.5.0-RC1"; };
-
-  clojure_binary = callPackage ../development/interpreters/clojure/binary.nix { };
-
-  clojure_wrapper = callPackage ../development/interpreters/clojure/wrapper.nix {
-    #clojure = clojure_binary;
-  };
-
-  clooj_standalone_binary = callPackage ../development/interpreters/clojure/clooj.nix { };
-
-  clooj_wrapper = callPackage ../development/interpreters/clojure/clooj-wrapper.nix {
-    clooj = clooj_standalone_binary;
-  };
+  clooj = callPackage ../development/interpreters/clojure/clooj.nix { };
 
   erlangR14B04 = callPackage ../development/interpreters/erlang/R14B04.nix { };
   erlangR15B03 = callPackage ../development/interpreters/erlang/R15B03.nix { };
@@ -3260,8 +3243,6 @@ let
 
   jmeter = callPackage ../applications/networking/jmeter {};
 
-  kaffe = callPackage ../development/interpreters/kaffe { };
-
   kona = callPackage ../development/interpreters/kona {};
 
   love = callPackage ../development/interpreters/love {lua=lua5;};
@@ -3506,14 +3487,6 @@ let
 
   apacheAnt = callPackage ../development/tools/build-managers/apache-ant { };
 
-  apacheAntOpenJDK = apacheAnt.override { jdk = openjdk; };
-  apacheAntOracleJDK = ant.override { jdk = pkgs.oraclejdk; };
-
-  apacheAntGcj = callPackage ../development/tools/build-managers/apache-ant/from-source.nix {
-    # must be either pre-built or built with GCJ *alone*
-    gcj = gcj.gcc; # use the raw GCJ, which has ${gcj}/lib/jvm
-  };
-
   astyle = callPackage ../development/tools/misc/astyle { };
 
   autobuild = callPackage ../development/tools/misc/autobuild { };
@@ -4604,14 +4577,6 @@ let
 
   hydraAntLogger = callPackage ../development/libraries/java/hydra-ant-logger { };
 
-  icedtea = callPackage ../development/libraries/java/icedtea {
-    ant = apacheAntGcj;
-    xerces = xercesJava;
-    xulrunner = icecatXulrunner3;
-    inherit (xlibs) libX11 libXp libXtst libXinerama libXt
-      libXrender xproto;
-  };
-
   icu = callPackage ../development/libraries/icu { };
 
   id3lib = callPackage ../development/libraries/id3lib { };
@@ -5641,7 +5606,6 @@ let
   redland = pkgs.librdf_redland;
 
   rhino = callPackage ../development/libraries/java/rhino {
-    ant = apacheAntGcj;
     javac = gcj;
     jvm = gcj;
   };
@@ -5700,7 +5664,7 @@ let
   SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { };
 
   serd = callPackage ../development/libraries/serd {};
-  
+
   serf = callPackage ../development/libraries/serf {};
 
   silgraphite = callPackage ../development/libraries/silgraphite {};
@@ -5969,12 +5933,6 @@ let
 
   xercesc = callPackage ../development/libraries/xercesc {};
 
-  xercesJava = callPackage ../development/libraries/java/xerces {
-    ant   = apacheAntGcj;  # for bootstrap purposes
-    javac = gcj;
-    jvm   = gcj;
-  };
-
   xlibsWrapper = callPackage ../development/libraries/xlibs-wrapper {
     packages = [
       freetype fontconfig xlibs.xproto xlibs.libX11 xlibs.libXt
@@ -6065,13 +6023,6 @@ let
 
   v8 = callPackage ../development/libraries/v8 { inherit (pythonPackages) gyp; };
 
-  xalanj = xalanJava;
-  xalanJava = callPackage ../development/libraries/java/xalanj {
-    ant    = apacheAntGcj;  # for bootstrap purposes
-    javac  = gcj;
-    jvm    = gcj;
-    xerces = xercesJava;  };
-
   xmlsec = callPackage ../development/libraries/xmlsec { };
 
   zziplib = callPackage ../development/libraries/zziplib { };
@@ -6081,20 +6032,26 @@ let
 
   jquery_ui = callPackage ../development/libraries/javascript/jquery-ui { };
 
+
   ### DEVELOPMENT / LISP MODULES
 
   asdf = callPackage ../development/lisp-modules/asdf {
     texLive = null;
   };
+
   clwrapperFunction = callPackage ../development/lisp-modules/clwrapper;
-  wrapLisp = lisp: clwrapperFunction {lisp=lisp;};
-  lispPackagesFor = clwrapper: callPackage ../development/lisp-modules/lisp-packages.nix{
+
+  wrapLisp = lisp: clwrapperFunction { inherit lisp; };
+
+  lispPackagesFor = clwrapper: callPackage ../development/lisp-modules/lisp-packages.nix {
     inherit clwrapper;
   };
+
   lispPackagesClisp = lispPackagesFor (wrapLisp clisp);
   lispPackagesSBCL = lispPackagesFor (wrapLisp sbcl);
   lispPackages = recurseIntoAttrs lispPackagesSBCL;
 
+
   ### DEVELOPMENT / PERL MODULES
 
   buildPerlPackage = import ../development/perl-modules/generic perl;
diff --git a/pkgs/top-level/release-python.nix b/pkgs/top-level/release-python.nix
index b56c7af6e037..aecb3c85aee8 100644
--- a/pkgs/top-level/release-python.nix
+++ b/pkgs/top-level/release-python.nix
@@ -59,8 +59,6 @@ let
   antlr = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   antlr3 = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   apacheAntGcj = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  apacheAntOpenJDK = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  apacheAntOracleJDK = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   apparmor = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   aqbanking = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   arb = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
@@ -162,8 +160,6 @@ let
   clisp = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   clisp_2_44_1 = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   clojure = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  clojure_wrapper = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  clooj_wrapper = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   clucene_core_2 = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   clutter = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   clutter_gtk = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
@@ -676,7 +672,6 @@ let
   icecat3Wrapper = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   icecat3Xul = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   icecatXulrunner3 = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  icedtea = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   icewm = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   idutils = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   ikiwiki = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
@@ -725,7 +720,6 @@ let
   julia = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   jwm = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   k3d = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  kaffe = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   kde3 = {
     arts = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
     kdelibs = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
@@ -1760,7 +1754,6 @@ let
   x11vnc = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   x2vnc = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   x2x = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  xalanJava = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xaos = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xapianBindings = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xapianBindings10 = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
@@ -1779,7 +1772,6 @@ let
   xdaliclock = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xdotool = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xen = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
-  xercesJava = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xf86_input_mtrack = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xf86_input_multitouch = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };
   xf86_input_wacom = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; };