summary refs log tree commit diff
path: root/gnu/packages/java.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/java.scm')
-rw-r--r--gnu/packages/java.scm779
1 files changed, 488 insertions, 291 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 5771366f66..a3395ad7da 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -79,24 +79,25 @@
 ;;;
 
 ;; The Java bootstrap begins with Jikes, a Java compiler written in C++.  We
-;; use it to build the SableVM standard library and virtual machine, which are
-;; written in a simpler dialect of Java and C, respectively.  This is
-;; sufficient to build an older version of Ant, which is needed to build an
-;; older version of ECJ, an incremental Java compiler, both of which are
-;; written in Java.
+;; use it to build a simple version of GNU Classpath, the Java standard
+;; library.  We chose version 0.93 because it is the last version that can be
+;; built with Jikes.  With Jikes and this version of GNU Classpath we can
+;; build JamVM, a Java Virtual Machine.  We build version 1.5.1 because it is
+;; the last version of JamVM that works with a version of GNU classpath that
+;; does not require ECJ.  These three packages make up the bootstrap JDK.
+
+;; This is sufficient to build an older version of Ant, which is needed to
+;; build an older version of ECJ, an incremental Java compiler, both of which
+;; are written in Java.
 ;;
-;; ECJ is needed to build the latest release of GNU Classpath (0.99).
-;; Classpath (> 0.98) is a requirement for JamVM, a more modern implementation
-;; of the Java virtual machine.
-;;
-;; With JamVM we can build the latest development version of GNU Classpath,
-;; which has much more support for Java 1.6 than the latest release.  Since
-;; the previous build of JamVM is limited by the use of GNU Classpath 0.99 we
-;; rebuild it with the latest development version of GNU Classpath.
-;;
-;; Finally, we use the bootstrap toolchain to build the OpenJDK with the
-;; Icedtea 1.x build framework.  We then build the more recent JDKs Icedtea
-;; 2.x and Icedtea 3.x.
+;; ECJ is needed to build the latest release (0.99) and the development
+;; version of GNU Classpath.  The development version of GNU Classpath has
+;; much more support for Java 1.6 than the latest release, but we need to
+;; build 0.99 first to get a working version of javah.  ECJ, the development
+;; version of GNU Classpath, and the latest version of JamVM make up the
+;; second stage JDK with which we can build the OpenJDK with the Icedtea 1.x
+;; build framework.  We then build the more recent JDKs Icedtea 2.x and
+;; Icedtea 3.x.
 
 (define jikes
   (package
@@ -117,114 +118,88 @@ defined in The Java Language Specification into the bytecoded instruction set
 and binary format defined in The Java Virtual Machine Specification.")
     (license license:ibmpl1.0)))
 
-(define sablevm-classpath
+;; This is the last version of GNU Classpath that can be built without ECJ.
+(define classpath-bootstrap
   (package
-    (name "sablevm-classpath")
-    (version "1.13")
+    (name "classpath")
+    (version "0.93")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/sablevm/sablevm/"
-                                  version "/sablevm-classpath-" version ".tar.gz"))
+              (uri (string-append "mirror://gnu/classpath/classpath-"
+                                  version ".tar.gz"))
               (sha256
                (base32
-                "1qyhyfz8idghxdam16hdgpa24r2x4xbg9z8c8asa3chnd79h3zw2"))))
+                "0i99wf9xd3hw1sj2sazychb9prx8nadxh2clgvk3zlmb28v0jbfz"))
+              (patches (search-patches "classpath-aarch64-support.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
-       (list "--with-jikes"
+       (list (string-append "JAVAC="
+                            (assoc-ref %build-inputs "jikes")
+                            "/bin/jikes")
              "--disable-Werror"
              "--disable-gmp"
              "--disable-gtk-peer"
+             "--disable-gconf-peer"
              "--disable-plugin"
              "--disable-dssi"
              "--disable-alsa"
-             "--disable-gjdoc")))
-    (inputs
-     `(("gconf" ,gconf)
-       ("gtk+" ,gtk+-2)))
+             "--disable-gjdoc")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-data
+           (lambda _ (zero? (system* "make" "install-data")))))))
     (native-inputs
      `(("jikes" ,jikes)
        ("fastjar" ,fastjar)
+       ("libltdl" ,libltdl)
        ("pkg-config" ,pkg-config)))
-    (home-page "http://sablevm.org/")
-    (synopsis "Java Virtual Machine")
-    (description "SableVM is a clean-room, highly portable and efficient Java
-virtual machine.  Its goals are to be reasonably small, fast, and compliant
-with the various specifications (JVM specification, JNI, invocation interface,
-etc.).  SableVM is no longer maintained.
-
-This package provides the classpath library.")
-    (license license:lgpl2.1+)))
+    (home-page "https://www.gnu.org/software/classpath/")
+    (synopsis "Essential libraries for Java")
+    (description "GNU Classpath is a project to create core class libraries
+for use with runtimes, compilers and tools for the Java programming
+language.")
+    ;; GPLv2 or later, with special linking exception.
+    (license license:gpl2+)))
 
-(define sablevm
+;; This is the last version of JamVM that works with a version of GNU
+;; classpath that does not require ECJ.
+(define jamvm-1-bootstrap
   (package
-    (name "sablevm")
-    (version "1.13")
+    (name "jamvm")
+    (version "1.5.1")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/sablevm/sablevm/"
-                                  version "/sablevm-" version ".tar.gz"))
+              (uri (string-append "mirror://sourceforge/jamvm/jamvm/"
+                                  "JamVM%20" version "/jamvm-"
+                                  version ".tar.gz"))
               (sha256
                (base32
-                "1jyg4bsym6igz94wps5443c7wiwlzinqzkchcw972nz4kf1cql6g"))))
+                "06lhi03l3b0h48pc7x58bk9my2nrcf1flpmglvys3wyad6yraf36"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
-       (list "--with-threading=switch" ; slower but prevents segfault
-             "--with-internal-libffi=no"
-             "--with-internal-libpopt=no")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'remove-timestamp-for-reproducibility
-           (lambda _
-             (substitute* "src/sablevm/Makefile.in"
-               (("\\$\\(SVMCOMPILETIME\\)") "(unknown)"))
-             #t))
-         (add-after 'unpack 'link-with-popt
-           (lambda _
-             (substitute* "src/sablevm/Makefile.in"
-               (("\\$\\(SVMADD\\)" match)
-                (string-append match " -lpopt")))
-             #t))
-         (add-after 'unpack 'patch-path-to-classpath
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "Makefile.in"
-               (("@datadir@/sablevm-classpath")
-                (string-append (assoc-ref inputs "classpath")
-                               "/share/sablevm-classpath")))
-             (substitute* "src/libsablevm/Makefile.in"
-               (("\\$\\(libdir\\)/sablevm-classpath")
-                (string-append (assoc-ref inputs "classpath")
-                               "/lib/sablevm-classpath"))
-               (("\\$\\(datadir\\)/sablevm-classpath")
-                (string-append (assoc-ref inputs "classpath")
-                               "/share/sablevm-classpath")))
-             #t)))))
+       (list (string-append "--with-classpath-install-dir="
+                            (assoc-ref %build-inputs "classpath")))))
     (inputs
-     `(("classpath" ,sablevm-classpath)
+     `(("classpath" ,classpath-bootstrap)
        ("jikes" ,jikes)
-       ("zlib" ,zlib)
-       ("popt" ,popt)
-       ("libffi" ,libffi)))
-    (native-inputs
-     `(("libltdl" ,libltdl)))
-    (home-page "http://sablevm.org/")
-    (synopsis "Java Virtual Machine")
-    (description "SableVM is a clean-room, highly portable and efficient Java
-virtual machine.  Its goals are to be reasonably small, fast, and compliant
-with the various specifications (JVM specification, JNI, invocation interface,
-etc.).  SableVM is no longer maintained.
-
-This package provides the virtual machine.")
-    (license license:lgpl2.1+)))
+       ("zlib" ,zlib)))
+    (home-page "http://jamvm.sourceforge.net/")
+    (synopsis "Small Java Virtual Machine")
+    (description "JamVM is a Java Virtual Machine conforming to the JVM
+specification edition 2 (blue book).  It is extremely small.  However, unlike
+other small VMs it supports the full spec, including object finalisation and
+JNI.")
+    (license license:gpl2+)))
 
 (define ant-bootstrap
   (package
     (name "ant-bootstrap")
     ;; The 1.10.x series requires Java 8.  1.9.0 and later use generics, which
     ;; are not supported.  The 1.8.x series is the last to use only features
-    ;; supported by Jikes, but it cannot seem to be built with sablevm.
-    (version "1.7.1")
+    ;; supported by Jikes.
+    (version "1.8.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://archive.apache.org/dist/"
@@ -232,24 +207,31 @@ This package provides the virtual machine.")
                                   version "-src.tar.bz2"))
               (sha256
                (base32
-                "19pvqvgkxgpgsqm4lvbki5sm0z84kxmykdqicvfad47gc1r9mi2d"))))
+                "1cg0lga887qz5iizh6mlkxp01lciymrhmp7wzxpl6zpnldxmzrjx"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f ; no "check" target
        #:phases
        (modify-phases %standard-phases
+         (delete 'bootstrap)
          (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
-             (setenv "JAVA_HOME"
-                     (string-append (assoc-ref inputs "sablevm")
-                                    "/lib/sablevm"))
+             (setenv "JAVA_HOME" (assoc-ref inputs "jamvm"))
              (setenv "JAVACMD"
-                     (string-append (assoc-ref inputs "sablevm")
-                                    "/bin/java-sablevm"))
+                     (string-append (assoc-ref inputs "jamvm")
+                                    "/bin/jamvm"))
              (setenv "JAVAC"
-                     (string-append (assoc-ref inputs "sablevm")
-                                    "/bin/javac-sablevm"))
+                     (string-append (assoc-ref inputs "jikes")
+                                    "/bin/jikes"))
+             (setenv "CLASSPATH"
+                     (string-append (assoc-ref inputs "jamvm")
+                                    "/lib/rt.jar"))
+
+             ;; Ant complains if this file doesn't exist.
+             (setenv "HOME" "/tmp")
+             (with-output-to-file "/tmp/.ant.properties"
+               (lambda _ (display "")))
 
              ;; Use jikes instead of javac for <javac ...> tags in build.xml
              (setenv "ANT_OPTS" "-Dbuild.compiler=jikes")
@@ -258,6 +240,11 @@ This package provides the virtual machine.")
              ;; interesting, so we silence them.
              (setenv "$BOOTJAVAC_OPTS" "-nowarn")
 
+             ;; Without these JamVM options the build may freeze.
+             (substitute* "bootstrap.sh"
+               (("^\"\\$\\{JAVACMD\\}\" " m)
+                (string-append m "-Xnocompact -Xnoinlining ")))
+
              ;; Disable tests because we are bootstrapping and thus don't have
              ;; any of the dependencies required to build and run the tests.
              (substitute* "build.xml"
@@ -268,7 +255,7 @@ This package provides the virtual machine.")
          (delete 'install))))
     (native-inputs
      `(("jikes" ,jikes)
-       ("sablevm" ,sablevm)))
+       ("jamvm" ,jamvm-1-bootstrap)))
     (home-page "http://ant.apache.org")
     (synopsis "Build tool for Java")
     (description
@@ -307,9 +294,12 @@ build process and its dependencies, whereas Make uses Makefile format.")
            (lambda* (#:key inputs #:allow-other-keys)
              (setenv "CLASSPATH"
                      (string-join
-                      (find-files (string-append (assoc-ref inputs "ant-bootstrap")
-                                                 "/lib")
-                                  "\\.jar$")
+                      (cons (string-append (assoc-ref inputs "jamvm")
+                                           "/lib/rt.jar")
+                            (find-files (string-append
+                                         (assoc-ref inputs "ant-bootstrap")
+                                         "/lib")
+                                        "\\.jar$"))
                       ":"))
              #t))
          (replace 'build
@@ -324,7 +314,7 @@ build process and its dependencies, whereas Make uses Makefile format.")
 Main-Class: org.eclipse.jdt.internal.compiler.batch.Main\n")))
 
              ;; Compile it all!
-             (and (zero? (apply system* "javac-sablevm"
+             (and (zero? (apply system* "jikes"
                                 (find-files "." "\\.java$")))
                   (zero? (system* "fastjar" "cvfm"
                                   "ecj-bootstrap.jar" "manifest" ".")))))
@@ -338,7 +328,8 @@ Main-Class: org.eclipse.jdt.internal.compiler.batch.Main\n")))
     (native-inputs
      `(("ant-bootstrap" ,ant-bootstrap)
        ("unzip" ,unzip)
-       ("sablevm" ,sablevm)
+       ("jikes" ,jikes)
+       ("jamvm" ,jamvm-1-bootstrap)
        ("fastjar" ,fastjar)))
     (home-page "https://eclipse.org")
     (synopsis "Eclipse Java development tools core batch compiler")
@@ -355,7 +346,7 @@ requirement for all GNU Classpath releases after version 0.93.")
     (arguments
      `(#:modules ((guix build utils))
        #:builder
-       (let ((backend 'sablevm))
+       (begin
          (use-modules (guix build utils))
          (let* ((bin    (string-append (assoc-ref %outputs "out") "/bin"))
                 (target (string-append bin "/javac"))
@@ -363,24 +354,12 @@ requirement for all GNU Classpath releases after version 0.93.")
                                        "/bin/guile"))
                 (ecj    (string-append (assoc-ref %build-inputs "ecj-bootstrap")
                                        "/share/java/ecj-bootstrap.jar"))
-                (java   (case backend
-                          ((sablevm)
-                           (string-append (assoc-ref %build-inputs "sablevm")
-                                          "/lib/sablevm/bin/java"))
-                          ((jamvm)
-                           (string-append (assoc-ref %build-inputs "jamvm")
-                                          "/bin/jamvm"))))
-                (bootcp (case backend
-                          ((sablevm)
-                           (let ((jvmlib (string-append
-                                          (assoc-ref %build-inputs "sablevm-classpath")
-                                          "/lib/sablevm")))
-                             (string-append jvmlib "/jre/lib/rt.jar")))
-                          ((jamvm)
-                           (let ((jvmlib (string-append (assoc-ref %build-inputs "classpath")
-                                                        "/share/classpath")))
-                             (string-append jvmlib "/lib/glibj.zip:"
-                                            jvmlib "/lib/tools.zip"))))))
+                (java   (string-append (assoc-ref %build-inputs "jamvm")
+                                       "/bin/jamvm"))
+                (bootcp (let ((jvmlib (string-append (assoc-ref %build-inputs "classpath")
+                                                     "/share/classpath")))
+                          (string-append jvmlib "/glibj.zip:"
+                                         jvmlib "/tools.zip"))))
            (mkdir-p bin)
            (with-output-to-file target
              (lambda _
@@ -399,10 +378,11 @@ requirement for all GNU Classpath releases after version 0.93.")
                         (define (main args)
                           (let ((classpath (getenv "CLASSPATH")))
                             (setenv "CLASSPATH"
-                                    (string-append ,ecj
-                                                   (if classpath
-                                                       (string-append ":" classpath)
-                                                       ""))))
+                                    (string-join (list ,ecj
+                                                       ,(string-append (assoc-ref %build-inputs "jamvm")
+                                                                       "/lib/rt.jar")
+                                                       (or classpath ""))
+                                                 ":")))
                           (receive (vm-args other-args)
                               ;; Separate VM arguments from arguments to ECJ.
                               (partition (cut string-prefix? "-J" <>)
@@ -412,6 +392,7 @@ requirement for all GNU Classpath releases after version 0.93.")
                                                args defaults))
                             (apply system* ,java
                                    (append
+                                    (list "-Xnocompact" "-Xnoinlining")
                                     ;; Remove "-J" prefix
                                     (map (cut string-drop <> 2) vm-args)
                                     '("org.eclipse.jdt.internal.compiler.batch.Main")
@@ -426,20 +407,17 @@ requirement for all GNU Classpath releases after version 0.93.")
     (native-inputs
      `(("guile" ,guile-2.2)
        ("ecj-bootstrap" ,ecj-bootstrap)
-       ("sablevm" ,sablevm)
-       ("sablevm-classpath" ,sablevm-classpath)))
+       ("jamvm" ,jamvm-1-bootstrap)
+       ("classpath" ,classpath-bootstrap)))
     (description "This package provides a wrapper around the @dfn{Eclipse
 compiler for Java} (ecj) with a command line interface that is compatible with
 the standard javac executable.")))
 
-;; Note: All the tool wrappers (e.g. for javah, javac, etc) fail with
-;; java.lang.UnsupportedClassVersionError.  They simply won't run on the old
-;; sablevm.  We use Classpath 0.99 to build JamVM, on which the Classpath
-;; tools do run.  Using these Classpath tools on JamVM we can then build the
-;; development version of GNU Classpath.
-(define classpath-on-sablevm
-  (package
-    (name "classpath")
+;; The classpath-bootstrap was built without a virtual machine, so it does not
+;; provide a wrapper for javah.  We cannot build the development version of
+;; Classpath without javah.
+(define classpath-0.99
+  (package (inherit classpath-bootstrap)
     (version "0.99")
     (source (origin
               (method url-fetch)
@@ -447,8 +425,8 @@ the standard javac executable.")))
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1j7cby4k66f1nvckm48xcmh352b1d1b33qk7l6hi7dp9i9zjjagr"))))
-    (build-system gnu-build-system)
+                "1j7cby4k66f1nvckm48xcmh352b1d1b33qk7l6hi7dp9i9zjjagr"))
+              (patches (search-patches "classpath-aarch64-support.patch"))))
     (arguments
      `(#:configure-flags
        (list (string-append "--with-ecj-jar="
@@ -458,8 +436,8 @@ the standard javac executable.")))
                             (assoc-ref %build-inputs "ecj-javac-wrapper")
                             "/bin/javac")
              (string-append "JAVA="
-                            (assoc-ref %build-inputs "sablevm")
-                            "/bin/java-sablevm")
+                            (assoc-ref %build-inputs "jamvm")
+                            "/bin/jamvm")
              "GCJ_JAVAC_TRUE=no"
              "ac_cv_prog_java_works=yes"  ; trust me
              "--disable-Werror"
@@ -478,51 +456,15 @@ the standard javac executable.")))
      `(("ecj-bootstrap" ,ecj-bootstrap)
        ("ecj-javac-wrapper" ,ecj-javac-wrapper)
        ("fastjar" ,fastjar)
-       ("sablevm" ,sablevm)
-       ("sablevm-classpath" ,sablevm-classpath)
+       ("jamvm" ,jamvm-1-bootstrap)
+       ("classpath" ,classpath-bootstrap)
        ("libltdl" ,libltdl)
-       ("pkg-config" ,pkg-config)))
-    (home-page "https://www.gnu.org/software/classpath/")
-    (synopsis "Essential libraries for Java")
-    (description "GNU Classpath is a project to create core class libraries
-for use with runtimes, compilers and tools for the Java programming
-language.")
-    ;; GPLv2 or later, with special linking exception.
-    (license license:gpl2+)))
-
-(define jamvm-bootstrap
-  (package
-    (name "jamvm")
-    (version "2.0.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://sourceforge/jamvm/jamvm/"
-                                  "JamVM%20" version "/jamvm-"
-                                  version ".tar.gz"))
-              (sha256
-               (base32
-                "1nl0zxz8y5x8gwsrm7n32bry4dx8x70p8z3s9jbdvs8avyb8whkn"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:configure-flags
-       (list (string-append "--with-classpath-install-dir="
-                            (assoc-ref %build-inputs "classpath")))))
-    (inputs
-     `(("classpath" ,classpath-on-sablevm)
-       ("ecj-javac-wrapper" ,ecj-javac-wrapper)
-       ("zlib" ,zlib)))
-    (home-page "http://jamvm.sourceforge.net/")
-    (synopsis "Small Java Virtual Machine")
-    (description "JamVM is a Java Virtual Machine conforming to the JVM
-specification edition 2 (blue book).  It is extremely small.  However, unlike
-other small VMs it supports the full spec, including object finalisation and
-JNI.")
-    (license license:gpl2+)))
+       ("pkg-config" ,pkg-config)))))
 
-;; We need this because the tools provided by the latest release of GNU
-;; Classpath don't actually work with sablevm.
+;; We need this because classpath-bootstrap does not provide all of the tools
+;; we need to build classpath-devel.
 (define classpath-jamvm-wrappers
-  (package (inherit classpath-on-sablevm)
+  (package (inherit classpath-0.99)
     (name "classpath-jamvm-wrappers")
     (source #f)
     (build-system trivial-build-system)
@@ -541,7 +483,7 @@ JNI.")
                        (with-output-to-file (string-append bin tool)
                          (lambda _
                            (format #t "#!~a/bin/sh
-~a/bin/jamvm -classpath ~a/share/classpath/tools.zip \
+~a/bin/jamvm -Xnocompact -Xnoinlining -classpath ~a/share/classpath/tools.zip \
 gnu.classpath.tools.~a.~a $@"
                                    bash jamvm classpath tool
                                    (if (string=? "native2ascii" tool)
@@ -556,106 +498,20 @@ gnu.classpath.tools.~a.~a $@"
            #t))))
     (native-inputs
      `(("bash" ,bash)
-       ("jamvm" ,jamvm-bootstrap)
-       ("classpath" ,classpath-on-sablevm)))
+       ("jamvm" ,jamvm-1-bootstrap)
+       ("classpath" ,classpath-0.99)))
     (inputs '())
     (synopsis "Executables from GNU Classpath")
     (description "This package provides wrappers around the tools provided by
 the GNU Classpath library.  They are executed by the JamVM virtual
 machine.")))
 
-(define ecj-javac-on-jamvm-wrapper
-  (package (inherit ecj-javac-wrapper)
-    (name "ecj-javac-on-jamvm-wrapper")
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       ;; TODO: This builder is exactly the same as in ecj-javac-wrapper,
-       ;; except that the backend is 'jamvm here.  Can we reuse the same
-       ;; builder somehow?
-       (let ((backend 'jamvm))
-         (use-modules (guix build utils))
-         (let* ((bin    (string-append (assoc-ref %outputs "out") "/bin"))
-                (target (string-append bin "/javac"))
-                (guile  (string-append (assoc-ref %build-inputs "guile")
-                                       "/bin/guile"))
-                (ecj    (string-append (assoc-ref %build-inputs "ecj-bootstrap")
-                                       "/share/java/ecj-bootstrap.jar"))
-                (java   (case backend
-                          ((sablevm)
-                           (string-append (assoc-ref %build-inputs "sablevm")
-                                          "/lib/sablevm/bin/java"))
-                          ((jamvm)
-                           (string-append (assoc-ref %build-inputs "jamvm")
-                                          "/bin/jamvm"))))
-                (bootcp (case backend
-                          ((sablevm)
-                           (let ((jvmlib (string-append
-                                          (assoc-ref %build-inputs "sablevm-classpath")
-                                          "/lib/sablevm")))
-                             (string-append jvmlib "/jre/lib/rt.jar")))
-                          ((jamvm)
-                           (let ((jvmlib (string-append (assoc-ref %build-inputs "classpath")
-                                                        "/share/classpath")))
-                             (string-append jvmlib "/lib/glibj.zip:"
-                                            jvmlib "/lib/tools.zip"))))))
-           (mkdir-p bin)
-           (with-output-to-file target
-             (lambda _
-               (format #t "#!~a --no-auto-compile\n!#\n" guile)
-               (write
-                `(begin (use-modules (ice-9 match)
-                                     (ice-9 receive)
-                                     (ice-9 hash-table)
-                                     (srfi srfi-1)
-                                     (srfi srfi-26))
-                        (define defaults
-                          '(("-bootclasspath" ,bootcp)
-                            ("-source" "1.5")
-                            ("-target" "1.5")
-                            ("-cp"     ".")))
-                        (define (main args)
-                          (let ((classpath (getenv "CLASSPATH")))
-                            (setenv "CLASSPATH"
-                                    (string-append ,ecj
-                                                   (if classpath
-                                                       (string-append ":" classpath)
-                                                       ""))))
-                          (receive (vm-args other-args)
-                              ;; Separate VM arguments from arguments to ECJ.
-                              (partition (cut string-prefix? "-J" <>)
-                                         (fold (lambda (default acc)
-                                                 (if (member (first default) acc)
-                                                     acc (append default acc)))
-                                               args defaults))
-                            (apply system* ,java
-                                   (append
-                                    ;; Remove "-J" prefix
-                                    (map (cut string-drop <> 2) vm-args)
-                                    '("org.eclipse.jdt.internal.compiler.batch.Main")
-                                    (cons "-nowarn" other-args)))))
-                        ;; Entry point
-                        (let ((args (cdr (command-line))))
-                          (if (null? args)
-                              (format (current-error-port) "javac: no arguments given!\n")
-                              (main args)))))))
-           (chmod target #o755)
-           #t))))
-    (native-inputs
-     `(("guile" ,guile-2.2)
-       ("ecj-bootstrap" ,ecj-bootstrap)
-       ("jamvm" ,jamvm-bootstrap)
-       ("classpath" ,classpath-on-sablevm)))
-    (description "This package provides a wrapper around the @dfn{Eclipse
-compiler for Java} (ecj) with a command line interface that is compatible with
-the standard javac executable.  The tool runs on JamVM instead of SableVM.")))
-
 ;; The last release of GNU Classpath is 0.99 and it happened in 2012.  Since
 ;; then Classpath has gained much more support for Java 1.6.
 (define-public classpath-devel
   (let ((commit "e7c13ee0cf2005206fbec0eca677f8cf66d5a103")
         (revision "1"))
-    (package (inherit classpath-on-sablevm)
+    (package (inherit classpath-bootstrap)
       (version (string-append "0.99-" revision "." (string-take commit 9)))
       (source (origin
                 (method git-fetch)
@@ -712,21 +568,35 @@ the standard javac executable.  The tool runs on JamVM instead of SableVM.")))
          ("texinfo" ,texinfo)
          ("classpath-jamvm-wrappers" ,classpath-jamvm-wrappers) ; for javah
          ("ecj-bootstrap" ,ecj-bootstrap)
-         ("ecj-javac-wrapper" ,ecj-javac-on-jamvm-wrapper)
+         ("ecj-javac-wrapper" ,ecj-javac-wrapper)
          ("fastjar" ,fastjar)
-         ("jamvm" ,jamvm-bootstrap)
+         ("jamvm" ,jamvm-1-bootstrap)
          ("libltdl" ,libltdl)
          ("pkg-config" ,pkg-config))))))
 
-(define-public jamvm
-  (package (inherit jamvm-bootstrap)
+(define jamvm
+  (package (inherit jamvm-1-bootstrap)
+    (version "2.0.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/jamvm/jamvm/"
+                                  "JamVM%20" version "/jamvm-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1nl0zxz8y5x8gwsrm7n32bry4dx8x70p8z3s9jbdvs8avyb8whkn"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--with-classpath-install-dir="
+                            (assoc-ref %build-inputs "classpath")))))
     (inputs
      `(("classpath" ,classpath-devel)
-       ("ecj-javac-wrapper" ,ecj-javac-on-jamvm-wrapper)
+       ("ecj-javac-wrapper" ,ecj-javac-wrapper)
        ("zlib" ,zlib)))))
 
-(define ecj-javac-on-jamvm-wrapper-final
-  (package (inherit ecj-javac-on-jamvm-wrapper)
+(define ecj-javac-wrapper-final
+  (package (inherit ecj-javac-wrapper)
     (native-inputs
      `(("guile" ,guile-2.2)
        ("ecj-bootstrap" ,ecj-bootstrap)
@@ -734,9 +604,9 @@ the standard javac executable.  The tool runs on JamVM instead of SableVM.")))
        ("classpath" ,classpath-devel)))))
 
 ;; The bootstrap JDK consisting of jamvm, classpath-devel,
-;; ecj-javac-on-jamvm-wrapper-final cannot build Icedtea 2.x directly, because
-;; it's written in Java 7.  It can, however, build the unmaintained Icedtea
-;; 1.x, which uses Java 6 only.
+;; ecj-javac-wrapper-final cannot build Icedtea 2.x directly, because it's
+;; written in Java 7.  It can, however, build the unmaintained Icedtea 1.x,
+;; which uses Java 6 only.
 (define-public icedtea-6
   (package
     (name "icedtea")
@@ -823,7 +693,8 @@ the standard javac executable.  The tool runs on JamVM instead of SableVM.")))
                     #t))))
          (add-after 'unpack 'use-classpath
            (lambda* (#:key inputs #:allow-other-keys)
-             (let ((jvmlib (assoc-ref inputs "classpath")))
+             (let ((jvmlib (assoc-ref inputs "classpath"))
+                   (jamvm  (assoc-ref inputs "jamvm")))
                ;; Classpath does not provide rt.jar.
                (substitute* "Makefile.in"
                  (("\\$\\(SYSTEM_JDK_DIR\\)/jre/lib/rt.jar")
@@ -831,7 +702,8 @@ the standard javac executable.  The tool runs on JamVM instead of SableVM.")))
                ;; Make sure we can find all classes.
                (setenv "CLASSPATH"
                        (string-append jvmlib "/share/classpath/glibj.zip:"
-                                      jvmlib "/share/classpath/tools.zip"))
+                                      jvmlib "/share/classpath/tools.zip:"
+                                      jamvm  "/lib/rt.jar"))
                (setenv "JAVACFLAGS"
                        (string-append "-cp "
                                       jvmlib "/share/classpath/glibj.zip:"
@@ -968,7 +840,7 @@ the standard javac executable.  The tool runs on JamVM instead of SableVM.")))
        ("cpio" ,cpio)
        ("cups" ,cups)
        ("ecj" ,ecj-bootstrap)
-       ("ecj-javac" ,ecj-javac-on-jamvm-wrapper-final)
+       ("ecj-javac" ,ecj-javac-wrapper-final)
        ("fastjar" ,fastjar)
        ("fontconfig" ,fontconfig)
        ("freetype" ,freetype)
@@ -4316,6 +4188,66 @@ in the @code{java.lang} package.  The following classes are included:
 @end itemize\n")
     (license license:asl2.0)))
 
+(define-public java-commons-bsf
+  (package
+    (name "java-commons-bsf")
+    (version "2.4.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://apache/commons/bsf/source/bsf-src-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1sbamr8jl32p1jgf59nw0b2w9qivyg145954hm6ly54cfgsqrdas"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (for-each delete-file
+                            (find-files "." "\\.jar$"))
+                  #t))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:build-target "jar"
+       #:tests? #f; No test file
+       #:modules ((guix build ant-build-system)
+                  (guix build utils)
+                  (guix build java-utils)
+                  (sxml simple))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'create-properties
+           (lambda _
+             ;; This file is missing from the distribution
+             (call-with-output-file "build-properties.xml"
+               (lambda (port)
+                 (sxml->xml
+                  `(project (@ (basedir ".") (name "build-properties") (default ""))
+                     (property (@ (name "project.name") (value "bsf")))
+                     (property (@ (name "source.level") (value "1.5")))
+                     (property (@ (name "build.lib") (value "build/jar")))
+                     (property (@ (name "src.dir") (value "src")))
+                     (property (@ (name "tests.dir") (value "src/org/apache/bsf/test")))
+                     (property (@ (name "build.tests") (value "build/test-classes")))
+                     (property (@ (name "build.dest") (value "build/classes"))))
+                  port)))))
+         (replace 'install (install-jars "build")))))
+    (native-inputs
+     `(("java-junit" ,java-junit)))
+    (inputs
+     `(("java-commons-logging-minimal" ,java-commons-logging-minimal)))
+    (home-page "https://commons.apache.org/proper/commons-bsf")
+    (synopsis "Bean Scripting Framework")
+    (description "The Bean Scripting Framework (BSF) is a set of Java classes
+which provides scripting language support within Java applications, and access
+to Java objects and methods from scripting languages.  BSF allows one to write
+JSPs in languages other than Java while providing access to the Java class
+library.  In addition, BSF permits any Java application to be implemented in
+part (or dynamically extended) by a language that is embedded within it.  This
+is achieved by providing an API that permits calling scripting language engines
+from within Java, as well as an object registry that exposes Java objects to
+these scripting language engines.")
+    (license license:asl2.0)))
+
 (define-public java-jsr305
   (package
     (name "java-jsr305")
@@ -5518,14 +5450,14 @@ logging framework for Java.")))
 (define-public java-commons-cli
   (package
     (name "java-commons-cli")
-    (version "1.3.1")
+    (version "1.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://apache/commons/cli/source/"
                                   "commons-cli-" version "-src.tar.gz"))
               (sha256
                (base32
-                "1fkjn552i12vp3xxk21ws4p70fi0lyjm004vzxsdaz7gdpgyxxyl"))))
+                "05hgi2z01fqz374y719gl1dxzqvzci5af071zm7vxrjg9vczipm1"))))
     (build-system ant-build-system)
     ;; TODO: javadoc
     (arguments
@@ -6150,7 +6082,7 @@ import org.antlr.grammar.v2.ANTLRTreePrinter;"))
                  (lambda _
                    (display
                      (string-append "#!" (which "sh") "\n"
-                                    "java -cp " jar "/antlr3-3.1-3.1.jar:"
+                                    "java -cp " jar "/antlr3-3.1.jar:"
                                     (string-concatenate
                                       (find-files (assoc-ref inputs "stringtemplate")
                                                   ".*\\.jar"))
@@ -6914,7 +6846,7 @@ package contains utilities for obtaining services via the Java SE 6
 (define-public java-aqute-bnd-annotation
   (package
     (name "java-aqute-bnd-annotation")
-    (version "3.4.0")
+    (version "3.5.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/bndtools/bnd/archive/"
@@ -6922,7 +6854,7 @@ package contains utilities for obtaining services via the Java SE 6
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "09vgb6axikbz66zi9falijbnzh1qnp9ysfns123dmzdb01cbza9q"))))
+                "1ggyiq0as0f6cz333a0dh98j72kmvv5pf2s47v9554yh905lfqdl"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-aqute-bnd-annotation.jar"
@@ -9262,6 +9194,39 @@ similar in functionality to BSD editline and GNU readline but with additional
 features that bring it on par with the Z shell line editor.")
     (license license:bsd-3)))
 
+(define-public java-jline-2
+  (package
+    (inherit java-jline)
+    (version "2.14.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/jline/jline2/archive/jline-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1c6qa26mf0viw8hg4jnv72s7i1qb1gh1l8rrzcdvqhqhx82rkdlf"))))
+    (arguments
+     `(#:jdk ,icedtea-8
+       ,@(package-arguments java-jline)))
+    (inputs
+     `(("java-jansi" ,java-jansi)
+       ("java-jansi-native" ,java-jansi-native)))
+    (native-inputs
+     `(("java-powermock-modules-junit4" ,java-powermock-modules-junit4)
+       ("java-powermock-modules-junit4-common" ,java-powermock-modules-junit4-common)
+       ("java-powermock-api-easymock" ,java-powermock-api-easymock)
+       ("java-powermock-api-support" ,java-powermock-api-support)
+       ("java-powermock-core" ,java-powermock-core)
+       ("java-powermock-reflect" ,java-powermock-reflect)
+       ("java-easymock" ,java-easymock)
+       ("java-jboss-javassist" ,java-jboss-javassist)
+       ("java-objenesis" ,java-objenesis)
+       ("java-asm" ,java-asm)
+       ("java-hamcrest-core" ,java-hamcrest-core)
+       ("java-cglib" ,java-cglib)
+       ("java-junit" ,java-junit)
+       ("java-hawtjni" ,java-hawtjni)))))
+
 (define-public java-xmlunit
   (package
     (name "java-xmlunit")
@@ -9364,3 +9329,235 @@ Java programmers to create two-dimensional charts and plots.  The library
 features an assortment of graph styles, including advanced scatter plots, bar
 graphs, and pie charts.")
     (license license:lgpl2.1+)))
+
+(define-public java-commons-httpclient
+  (package
+    (name "java-commons-httpclient")
+    (version "3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://archive.apache.org/dist/httpcomponents/"
+                                  "commons-httpclient/source/commons-httpclient-"
+                                  version "-src.tar.gz"))
+              (sha256
+               (base32
+                "1wlpn3cfy3d4inxy6g7wxcsa8p7sshn6aldk9y4ia3lb879rd97r"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:build-target "compile"
+       #:test-target "test"
+       #:tests? #f; requires junit-textui (junit 3)
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-accent
+           (lambda _
+             (for-each (lambda (file)
+                         (with-fluids ((%default-port-encoding "ISO-8859-1"))
+                          (substitute* file
+                            (("\\* @author Ortwin .*") "* @author Ortwin Glueck\n"))))
+               '("src/java/org/apache/commons/httpclient/HttpContentTooLargeException.java"
+                 "src/examples/TrivialApp.java" "src/examples/ClientApp.java"
+                 "src/test/org/apache/commons/httpclient/TestHttps.java"
+                 "src/test/org/apache/commons/httpclient/TestURIUtil2.java"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "ant" "dist"
+                     (string-append "-Ddist.home=" (assoc-ref outputs "out")
+                                    "/share/java"))
+             #t)))))
+    (propagated-inputs
+     `(("java-commons-logging" ,java-commons-logging-minimal)
+       ("java-commons-codec" ,java-commons-codec)))
+    (home-page "https://hc.apache.org")
+    (synopsis "HTTP/1.1 compliant HTTP agent implementation")
+    (description "This package contains an HTTP/1.1 compliant HTTP agent
+implementation.  It also provides reusable components for client-side
+authentication, HTTP state management, and HTTP connection management.")
+    (license license:asl2.0)))
+
+(define-public java-commons-vfs
+  (package
+    (name "java-commons-vfs")
+    (version "2.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://apache/commons/vfs/source/"
+                                  "commons-vfs2-distribution-" version "-src.tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1cnq1iaghbp4cslpnvwbp83i5v234x87irssqynhwpfgw7caf1s3"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (for-each delete-file
+                            (find-files "." "\\.jar$"))
+                  #t))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "commons-vfs.jar"
+       #:source-dir "commons-vfs2/src/main/java"
+       #:test-dir "commons-vfs2/src/test"
+       ; FIXME: tests depend on many things: apache sshd, hadoop, ftpserver, ...
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'remove-hadoop-and-webdav
+           ; Remove these files as they are not required and depend on difficult
+           ; packages.
+           (lambda _
+             (for-each delete-file-recursively
+               '("commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav"
+                 "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs")))))))
+    (inputs
+     `(("java-commons-collections4" ,java-commons-collections4)
+       ("java-commons-compress" ,java-commons-compress)
+       ("java-commons-httpclient" ,java-commons-httpclient)
+       ("java-commons-logging-minimal" ,java-commons-logging-minimal)
+       ("java-commons-net" ,java-commons-net)
+       ("java-jsch" ,java-jsch)))
+    (home-page "http://commons.apache.org/proper/commons-vfs/")
+    (synopsis "Java filesystem library")
+    (description "Commons VFS provides a single API for accessing various
+different file systems.  It presents a uniform view of the files from various
+different sources, such as the files on local disk, on an HTTP server, or
+inside a Zip archive.")
+    (license license:asl2.0)))
+
+(define-public java-jakarta-oro
+  (package
+    (name "java-jakarta-oro")
+    (version "2.0.8")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://archive.apache.org/dist/jakarta/oro/"
+                                  "jakarta-oro-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0rpmnsskiwmsy8r0sckz5n5dbvh3vkxx8hpm177c754r8xy3qksc"))
+              (modules '((guix build utils)))
+              (snippet
+               `(begin
+                  (delete-file (string-append "jakarta-oro-" ,version ".jar"))
+                  #t))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:build-target "package"
+       #:tests? #f; tests are run as part of the build process
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'install
+           (install-jars ,(string-append "jakarta-oro-" version))))))
+    (home-page "https://jakarta.apache.org/oro/")
+    (synopsis "Text-processing for Java")
+    (description "The Jakarta-ORO Java classes are a set of text-processing
+Java classes that provide Perl5 compatible regular expressions, AWK-like
+regular expressions, glob expressions, and utility classes for performing
+substitutions, splits, filtering filenames, etc.  This library is the successor
+of the OROMatcher, AwkTools, PerlTools, and TextTools libraries originally
+from ORO, Inc.")
+    (license license:asl1.1)))
+
+(define-public java-native-access
+  (package
+    (name "java-native-access")
+    (version "4.5.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/java-native-access/jna/"
+                                  "archive/" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0zrpzkib6b905i018a9pqlzkqinphywr6y4jwv6mwp63jjqvqkd9"))
+              (modules '((guix build utils)))
+              (snippet
+                `(begin
+                   (for-each delete-file (find-files "." ".*.jar"))
+                   (delete-file-recursively "native/libffi")
+                   (delete-file-recursively "dist")
+                   #t))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:tests? #f; FIXME: tests require reflections.jar
+       #:test-target "test"
+       #:make-flags (list "-Ddynlink.native=true")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-build.xml
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "build.xml"
+               ;; Since we removed the bundled ant.jar, give the correct path
+               (("lib/ant.jar") (string-append (assoc-ref inputs "ant") "/lib/ant.jar"))
+               ;; We removed generated native libraries. We can only rebuild one
+               ;; so don't fail if we can't find a native library for another architecture.
+               (("zipfileset") "zipfileset erroronmissingarchive=\"false\""))
+             ;; Copy test dependencies
+             (copy-file (string-append (assoc-ref inputs "java-junit")
+                                       "/share/java/junit.jar")
+                        "lib/junit.jar")
+             (copy-file (string-append (assoc-ref inputs "java-hamcrest-core")
+                                       "/share/java/hamcrest-core.jar")
+                        "lib/hamcrest-core.jar")
+             ;; FIXME: once reflections.jar is built, copy it to lib/test.
+             #t))
+         (add-before 'build 'build-native
+           (lambda _
+             (invoke "ant" "-Ddynlink.native=true" "native")
+             #t))
+         (replace 'install
+           (install-jars "build")))))
+    (inputs
+     `(("libffi" ,libffi)
+       ("libx11" ,libx11)
+       ("libxt" ,libxt)))
+    (native-inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)))
+    (home-page "https://github.com/java-native-access/jna")
+    (synopsis "Access to native shared libraries from Java")
+    (description "JNA provides Java programs easy access to native shared
+libraries without writing anything but Java code - no JNI or native code is
+required.  JNA allows you to call directly into native functions using natural
+Java method invocation.")
+    ;; Java Native Access project (JNA) is dual-licensed under 2
+    ;; alternative Free licenses: LGPL 2.1 or later and Apache License 2.0.
+    (license (list
+               license:asl2.0
+               license:lgpl2.1+))))
+
+(define-public java-native-access-platform
+  (package
+    (inherit java-native-access)
+    (name "java-native-access-platform")
+    (arguments
+     `(#:test-target "test"
+       #:tests? #f; require jna-test.jar
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'chdir
+           (lambda _
+             (chdir "contrib/platform")
+             #t))
+         (add-after 'chdir 'fix-ant
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "nbproject/project.properties"
+               (("../../build/jna.jar")
+                (string-append (assoc-ref inputs "java-native-access")
+                               "/share/java/jna.jar"))
+               (("../../lib/hamcrest-core-.*.jar")
+                (string-append (assoc-ref inputs "java-hamcrest-core")
+                               "/share/java/hamcrest-core.jar"))
+               (("../../lib/junit.jar")
+                (string-append (assoc-ref inputs "java-junit")
+                               "/share/java/junit.jar")))
+             #t))
+         (replace 'install
+           (install-jars "dist")))))
+    (inputs
+     `(("java-native-access" ,java-native-access)))
+    (synopsis "Cross-platform mappings for jna")
+    (description "java-native-access-platfrom has cross-platform mappings
+and mappings for a number of commonly used platform functions, including a
+large number of Win32 mappings as well as a set of utility classes that
+simplify native access.")))