Installing rJava in Mac M1

Hello all,

I am trying to download rJava for R in order for me to use the RJDBC library and extract information from a specific table I have on RedShift. However, I have been unsuccessfully able to download this library. I've seen in some post to go to a website called Azul and download the Java version from M1 there. Has any one of you has experienced this before (for those users using the M1)?

Exact error message once I try to import the RJDBC library:

Loading required package: rJava
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JVM could not be found
Error: package ‘rJava’ could not be loaded
In addition: Warning messages:
1: In fun(libname, pkgname) : JAVA_HOME is set incorrectly! Ingoring.
2: In system("/usr/libexec/java_home", intern = TRUE) :
  running command '/usr/libexec/java_home' had status 1
3: In fun(libname, pkgname) :
  Cannot find JVM library 'NA/lib/server/libjvm.dylib'
Install Java and/or check JAVA_HOME (if in doubt, do NOT set it, it will be detected)

Make sure you have Java Development Kit (JDK) installed in your system (not JRE) and then run R CMD javareconf in your system terminal (not the R console).

Thanks andres managed to sort this one out.