Sample Header Ad - 728x90

How to replace stock java with downloaded binary?

0 votes
1 answer
57 views
In Debian Stable the latest
version available is
.
$ which -a java
/usr/bin/java
/bin/java
$ java --version
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment (build 17.0.8+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.8+7-Debian-1deb12u1, mixed mode, sharing)
I wanted to test out
which will be released soon so I downloaded the binaries directly.
$ curl https://download.java.net/java/GA/jdk21/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-21_linux-x64_bin.tar.gz 
$ tar -xzf openjdk-21_linux-x64_bin.tar.gz
$ cd jdk-21
$ ./bin/java --version
openjdk 21 2023-09-19
OpenJDK Runtime Environment (build 21+35-2513)
OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
$ which -a java
/usr/bin/java
/bin/java
$ java --version
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment (build 17.0.8+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.8+7-Debian-1deb12u1, mixed mode, sharing)
I would like all my scripts to use the new java binaries without having to manually edit all
entries in them. That is, when invoking
I would like the new binaries to run. Can I replace stock
by simply copy pasting to
/usr/bin/
and
/bin/
? That is, will this work?
$ mv ./bin/* /usr/bin/
$ mv ./bin/* /bin/
Do I also need to copy other folders in
-21
such as
and
? Can replacing stock java cause any side effects?
Asked by yyhh344 (1 rep)
Aug 28, 2023, 10:32 PM
Last activity: Aug 29, 2023, 01:19 AM