diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 15e4ae6c86..251d1d8481 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -2031,27 +2031,11 @@ (define-public hdf5-examples
     (inputs (list hdf5 zlib))
     (native-inputs (list autoconf-2.71 automake gfortran))))
 
-;; Keep this in sync with the current hdf5 package.
-(define-public hdf-java
+(define-public hdf5-java
   (package
-    (name "hdf-java")
-    (version "1.14.3")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/HDFGroup/hdf5")
-             (commit (string-append "hdf5-"
-                                    (string-map
-                                     (lambda (c) (if (char=? c #\.) #\_ c))
-                                     version)))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "0lw9f62zxyjiv7vx9nvnashjj39i44j8d626i7b788zkxw58csvs"))
-       (modules '((guix build utils)))
-       (snippet     ; Make sure we don't use the bundled sources and binaries.
-        '(for-each delete-file
-                   (find-files "java/lib" "\\.jar$")))))
+    (name "hdf5-java")
+    (version (package-version hdf5))
+    (source (package-source hdf5))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -2074,8 +2058,7 @@ (define-public hdf-java
                     (hamcrest
                      (search-input-file
                       inputs "/lib/m2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar")))
-                (substitute* (append (find-files "java" "Makefile.am")
-                                     (find-files "java" "Makefile.in"))
+                (substitute* (find-files "java" "Makefile.am")
                   (("\\$\\(top_srcdir\\)/java/lib/ext/slf4j-simple-2.0.6.jar")
                    simple)
                   (("\\$\\(top_srcdir\\)/java/lib/slf4j-api-2.0.6.jar")
@@ -2085,10 +2068,10 @@ (define-public hdf-java
                   (("\\$\\(top_srcdir\\)/java/lib/hamcrest-core.jar")
                    hamcrest))
                 (substitute* '("java/test/junit.sh.in"
-                               "java/examples/datatypes/JavaDatatypeExample.sh.in"
-                               "java/examples/datasets/JavaDatasetExample.sh.in"
-                               "java/examples/intro/JavaIntroExample.sh.in"
-                               "java/examples/groups/JavaGroupExample.sh.in")
+                               "HDF5Examples/JAVA/H5D/JavaDatasetExample.sh.in"
+                               "HDF5Examples/JAVA/H5G/JavaGroupExample.sh.in"
+                               "HDF5Examples/JAVA/H5T/JavaDatatypeExample.sh.in"
+                               "HDF5Examples/JAVA/TUTR/runExample.sh.in")
                   (("^LIST_JAR_TESTFILES=\"" m)
                    (string-append m hamcrest "\n"
                                   junit "\n"
@@ -2108,30 +2091,32 @@ (define-public hdf-java
                   (("/usr/bin/uname")
                    (search-input-file inputs "/bin/uname")))
                 (substitute* (find-files "java/test/testfiles/" ".*\\.txt$")
-                  (("JUnit version 4.11")
-                   "JUnit version 4.12-SNAPSHOT"))))))))
+                  (("JUnit version 4.13.2")
+                   "JUnit version 4.12-SNAPSHOT")))))
+          (add-after 'unpack 'patch-trace-shebang
+            (lambda _
+              (for-each patch-shebang
+                        (find-files "bin" (lambda (file stat)
+                                            (executable-file? file))))))
+          (add-after 'unpack 'generate-flexbison
+            (lambda _
+              (invoke "bash" "bin/genparser" "hl/src"))))))
     (native-inputs
-     (list `(,icedtea "jdk")
-           ;; For tests:
-           java-hamcrest-core
-           java-junit
-           java-slf4j-simple))
+     (modify-inputs (package-native-inputs hdf5)
+       (prepend `(,icedtea "jdk"))
+       (prepend java-hamcrest-core)
+       (prepend java-junit)
+       (prepend java-slf4j-simple)
+       (delete "gfortran")))
     (inputs
-     (list hdf4
-           hdf5
-           java-slf4j-api
+     (list java-slf4j-api
            libjpeg-turbo
            zlib))
     (home-page "https://www.hdfgroup.org")
-    (synopsis "Java interface for the HDF4 and HDF5 libraries")
-    (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
-the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
-implemented in C.")
-
-    ;; BSD-style license:
-    (license (license:x11-style
-              "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
-/current/src/unpacked/COPYING.html"))))
+    (synopsis "Java interface for the HDF5 library")
+    (description "The Java HDF5 Interface (JHI5) uses the Java Native
+Interface to wrap the HDF5 library, which is implemented in C.")
+    (license (package-license hdf5))))
 
 (define-public hdf-eos2
   (package
