Not only 32-bit versus 64-bit is important, but also that the JDK is compiled for the ARM-processor. For that reason I prefer to use BellSoft LibericaJDK which has a Raspberry Pi-version and also includes JavaFX in case you want to run a JavaFX UI-application.
E.g. to use JDK 13 on Raspbian OS:
$ cd /home/pi
$ wget https://download.bell-sw.com/java/13/bellsoft-jdk13-linux-arm32-vfp-hflt.deb
$ sudo apt-get install ./bellsoft-jdk13-linux-arm32-vfp-hflt.deb
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
When this is done, we can check the version again and it should look like this:
$ java --version
openjdk version "13-BellSoft" 2019-09-17
OpenJDK Runtime Environment (build 13-BellSoft+33)
OpenJDK Server VM (build 13-BellSoft+33, mixed mode)
More info on https://webtechie.be/post/2020-04-08-installing-java-and-javafx-on-raspberry-pi/
file /home/pi/.sdkman/candidates/java/11.0.7-open/bin/java?file /home/pi/.sdkman/candidates/java/11.0.7-open/bin/java.sdkman/candidates/java/current/bin/java: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=092cfbfe7cf2936bdbc489b4ec39bebcff2b0b12, not stripped