Dependency of rJava on JDK - rjava

Why does rJava need the entire JDK installed instead of just the JRE ? (jvm.dll is available in the JRE)
Let us assume that the path to jvm.dll and all other environment variables are set correctly.

The rJava package does not need JDK. JRE is sufficient for all the functions. Previous errors were related to 64bit JDK only bundling 32bit JRE. And that was the problem.

Related

How do I switch my Gradle from JRE to JDK

I have a program that requires gradle to run on jdk, but it keeps running on jre, and I do not know how to stop it. I have tried uninstalling jre, then both jre and jdk and reinstalling jdk only, but none of this has worked.
Unless you have configured it otherwise, Gradle will run all Java related tasks using the JVM that runs Gradle itself.
So the simpler approach is to make sure that your JAVA_HOME environment variable points to a JDK and start Gradle with it.

How to install OpenJDK 11 on Windows?

In the past, Oracle used to publish an executable installers for Windows that would:
Unpack files
Add registry keys indicating the installed version and path
Add the JRE to the system PATH
Register an uninstaller with Windows.
As of Java 11, the Oracle's free version of Java (Oracle OpenJDK) doesn't seem to include an installer. It is just a zip file containing the binaries.
How are we supposed to install OpenJDK 11 on Windows seeing as the aforementioned integrations are no longer there? Aren't they necessary?
Extract the zip file into a folder, e.g. C:\Program Files\Java\ and it will create a jdk-11 folder (where the bin folder is a direct sub-folder). You may need Administrator privileges to extract the zip file to this location.
Set a PATH:
Select Control Panel and then System.
Click Advanced and then Environment Variables.
Add the location of the bin folder of the JDK installation to the PATH variable in System Variables.
The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;"C:\Program Files\Java\jdk-11\bin"
Set JAVA_HOME:
Under System Variables, click New.
Enter the variable name as JAVA_HOME.
Enter the variable value as the installation path of the JDK (without the bin sub-folder).
Click OK.
Click Apply Changes.
Configure the JDK in your IDE (e.g. IntelliJ or Eclipse).
You are set.
To see if it worked, open up the Command Prompt and type java -version and see if it prints your newly installed JDK.
If you want to uninstall - just undo the above steps.
Note: You can also point JAVA_HOME to the folder of your JDK installations and then set the PATH variable to %JAVA_HOME%\bin. So when you want to change the JDK you change only the JAVA_HOME variable and leave PATH as it is.
Java 17 (LTS) and up
For Java 17 and up, you can use the Eclipse Adoptium website. According to their about section, the Eclipse Adoptium project is the continuation of the original AdoptOpenJDK mission.
Java 11 (LTS), Java 8 - 16
For Java 11 (8 through 16), you can use AdoptOpenJDK, a website hosted by the java community. You can find .msi installers for OpenJDK 8 through 16 there, which will perform all the things listed in the question (Unpacking, registry keys, PATH variable updating (and JAVA_HOME), uninstaller...).
Use the Chocolatey packet manager. It's a command-line tool similar to npm. Once you have installed it, use
choco install openjdk --version=11.0
in an elevated command prompt to install OpenJDK 11 (leave out the --version parameter to install the latest version).
To update an installed version to the latest version, type
choco upgrade openjdk
Pretty simple to use and especially helpful to upgrade to the latest version. No manual fiddling with path environment variables.
From the comment by #ZhekaKozlov: ojdkbuild has OpenJDK builds (currently 8 and 11) for Windows (zip and msi).
You can use Amazon Corretto. It is free to use multiplatform, production-ready distribution of the OpenJDK. It comes with long-term support that will include performance enhancements and security fixes. Check the installation instructions here.
You can also check Zulu from Azul.
One more thing I like to highlight here is both Amazon Corretto and Zulu are TCK Compliant. You can see the OpenJDK builds comparison here and here.
For Java 12 onwards, official General-Availability (GA) and Early-Access (EA) Windows 64-bit builds of the OpenJDK (GPL2 + Classpath Exception) from Oracle are available as tar.gz/zip from the JDK website.
If you prefer an installer, there are several distributions. There is a public Google Doc and Blog post by the Java Champions community which lists the best-supported OpenJDK distributions. Currently, these are:
AdoptOpenJDK has been superseded by Adoptium/Temurin (Hotspot) and IBM Semeru (OpenJ9)
Adoptium Temurin
Amazon Corretto
IBM Semeru (with OpenJ9 JVM)
Liberica from Bellsoft
Microsoft Build of OpenJDK
OpenLogic OpenJDK
Red Hat OpenJDK
SAPMachine (backed by SAP)
Zulu Community (backed by Azul Systems)
https://www.openlogic.com/openjdk-downloads allowed me to pick a 32-bit version of OpenJDK8 (don't ask - Arduino IDE doesn't compile with 11), I think they just wrap around AdoptOpenJDK MSIs but I couldn't find 32-bit distros on AdoptOpenJDK.
In addition to the above answers, it is worth noting that you have to move your JDK Path entry to the top of the Path
Here is the complete answer. first of all you have to install the Chocolatey. to install Chocolatey run powershell as administrator and run the following command
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
after this run open cmd as administrator and run this command
choco install -y openjdk11
it will install the openjdk to the following location
C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot
finllay set your JAVA_HOME TO
C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot
and cheers
WinGet is now available on Windows 10+ to install the Microsoft Build of OpenJDK on your machine. See details and access the downloads page at https://aka.ms/msopenjdk/ where Zip files and instructions.
Scoop installs programs you know and love, from the command line with a minimal amount of friction.
Install scoop
Add java scoop bucket add java
Install OpenJDK scoop.cmd install openjdk17

SonarQube - Unable to load the Wrapper's native library 'wrapper.dll'

I'm installing SonarQube v5.0.
I'm running Windows Server 2012 64-bit (a virtual OS), Java 1.8 64-bit, and the SonarQube windows-x86-64 wrapper.
SonarQube, whether run via StartSonar.bat using Command Prompt as Administrator or as a Windows Service, keeps throwing the following warning:
WARNING - Unable to load the Wrapper's native library 'wrapper.dll'.
The file is located on the path at the following location but
could not be loaded:
C:\sonarqube-5.0.1\bin\windows-x86-64\.\lib\wrapper.dll
Please verify that the file is readable by the current user
and that the file has not been corrupted in any way.
One common cause of this problem is running a 32-bit version
of the Wrapper with a 64-bit version of Java, or vica versa.
This is a 32-bit JVM.
Reported cause:
C:\sonarqube-5.0.1\bin\windows-x86-64\lib\wrapper.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
System signals will not be handled correctly.
The only info that I've found on the web is some JIRA's from 2010 that don't really help me. I can't create a sonar user on this Windows installation. All my other tools in my CI environment are running on Java 1.8 64-bit, which means that JAVA_HOME is set to JDK 1.8 64-bit. I really don't want to have to run Java 32-bit and the 32-bit Wrapper. That means that the JRE bin/java path at the top of wrapper.conf will have to specify the 32-bit JRE.
What can I do to get rid of this warning?
Not all applications use JAVA_HOME variable, so you can have JAVA_HOME pointing on your 64 bits version while you are using a 32 bits.
Note: the 'Java_Home' key in the registry is not the JAVA_HOME variable.
Well, one way to be sure is to uninstall the current service, with ..\windows-x86-64\UninstallNTService.bat and install the 32 bits version with ..\windows-x86-32\InstallNTService.bat.
If it works, you definitively have a 32 bits JVM.
Installed the service SonarQube in \sonarqube-5.1.2\bin\windows-x86-64.
I just went to the SonarQube in the Windows Services-->go to properties-->Log On tab--->select 'Local Service'(Entered the system password). Thats it!
Issue was resolved.
Hope this helps someone who was not able to resolve from the above posts.
I experienced the same problem with SonarQube 5.6.4 on Windows 7. Editing the sonar.properties file to add a wrapper.java.command=... had no effect. Editing my path statement did the trick, though.
The first two folders in my path statement had been
C:\ProgramData\Oracle\Java\javapath;C:\dev\sdks\jdk1.8.0_112\bin;....
The java.exe in the first (C:\ProgramData\Oracle\Java\javapath) is 32-bit. I just switched the two in my path:
C:\dev\sdks\jdk1.8.0_112\bin;C:\ProgramData\Oracle\Java\javapath;...
Suddenly SonarQube started using the 64-bit java.exe in C:\dev\sdks\jdk1.8.0_112\bin
After making this change, I was able to restart Firefox without any difficulty.
In my case, running on SonarQube 7.3 on window 7 or window 10, I have to update Java version to java 8 to pass this error.
No need for this, In my case I just Installed Java SE JDK 11.0.16 and installed it, and restarted the sonar server and it worked. Below is the URL to download
https://www.techspot.com/downloads/5553-java-jdk.html

Running install4j installer on Mac OS 10.7.4 with Oracle JRE1.7

I have a installer which is built with install4j 5.1.2. When i try to install it on Mac OS X 10.7.4. It complains saying
"No JVM could be found on you
system.
Please define EXE4J_JAVA_HOME
to point to an installed JDK or JRE or download a JRE from
www.java.com"
Then i download just the JRE1.7_07 from Oracle and tried again, i got the same error. Where as if i install full JDK1.7_07, then everything works fine.
Additional Information:
If i use Apple JRE 1.6 installer works fine. But my app needs JRE 1.7.
I also defined environment variables for JAVA_HOME, EXE4J_JAVA_HOME when i installed JRE1.7, Still i saw the same error. I have a feeling that, install4J is not reading the JRE when JRE is installed.
If i install JDK, then the JRE is in the following location
/Library/Java/JavaVirtualMachine/
where as if i install only JRE, it is in the following location
/Library/Internet Plug-ins/JavaAppletPlugin.plugin
I am not sure, if i am missing something. any pointers on how to resolve this particular issue is very helpful.
I got below email from install4j support.
Hi,
Thanks for your email. Indeed, 5.1.2 cannot find the JRE but only the JDK, since
the JRE was not released when OpenJDK support was implemented for install4j. This
is implemented in the current 5.1.3 build:
http://download.ej-technologies.com/beta/install4j_windows_5_1_3.exe
http://download.ej-technologies.com/beta/install4j_windows-x64_5_1_3.exe
It will be released at the end of the month.
Kind regards,

"JRE 1.3 or higher must be installed!" / "JDK 1.3 or higher must be installed!" errors installing JAI 1.1.3 on Windows 7 (x64)

I am getting these errors...
Severe: JRE 1.3 or higher must be installed!
Severe: JDK 1.3 or higher must be installed!
...when installing JAI (Java Advanced Imaging) 1.1.3 on Windows 7 (x64), with JRE 7 (1.7) installed at "C:\Program Files\Java\jre7" and JDK 7 (1.7) installed at "C:\Program Files\Java\jdk1.7.0".
Following http://download.java.net/media/jai/builds/release/1_1_3/INSTALL.html#Windows, specifically this is what I did:
Visited:
http://download.java.net/media/jai/builds/release/
http://download.java.net/media/jai/builds/release/1_1_3/ (latest version)
Downloaded:
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jdk.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jre.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586.jar.zip
EDIT (QUESTION): It would be great if someone could break down the difference between these files. The instructions at http://download.java.net/media/jai/builds/release/1_1_3/INSTALL.html#Windows do not go into enough detail and assume you already know what's what.
EDIT: As noted in the comments below, the .exe are exclusive installs, but I wished to install them to all three locations (to "C:\Program Files (x86)\Sun Microsystems\Java Advanced Imaging 1.1.3" as well as to my JDK and JRE locations), as I was not sure which I would need at my work as a Java developer. As far as I know, I just need to install the JDK version, and the .zip is a manual install of the same thing. I am not sure though! Unverified.
Installed:
jai-1_1_3-lib-windows-i586.exe (installed fine)
jai-1_1_3-lib-windows-i586-jre.exe <---- this is what causes one of the errors.
jai-1_1_3-lib-windows-i586-jdk.exe <---- this is what causes one of the errors.
The errors appear to be the same issue of not finding where Java (JRE and JDK) is installed.
I have the following environment variables set:
JAVA_HOME = C:\Program Files\Java\jdk1.7.0
Path = ...;C:\Program Files\Java\jdk1.7.0\bin
EDIT: This makes me think the problem is something deeper than environment variables, as there's no environment variables for JRE like there is for JDK (i.e., JAVA_HOME), right?
Fixes I have tried (to no avail):
Re-installing*.
Re-downloading and re-installing*.
Adding "C:\Program Files\Java\jre7\bin" to "Path" and re-installing*.
Adding "C:\Program Files\Java\jre7" to "Path", without removing the above Path addition, and re-installing*.
Adding "C:\PROGRA~1\Java\jre7" to "Path", and verified it was the proper folder, and re-installing*.
Changing JAVA_HOME from "C:\Program Files\Java\jdk1.7.0" to "C:\PROGRA~1\Java\JDK17~1.0", and verified it properly forwards back to the original folder in Windows, and re-installing*.
Re-installing Java to a non-space folder, "C:\xxx\xxx\jdk1.7.0", where the x's are letters not spaces, and verified it works properly with "java -version" command line, and re-installing**.
*Downloading and installing jai-1_1_3-lib-windows-i586-jre.exe
**Downloading and installing jai-1_1_3-lib-windows-i586-jdk.exe
None of this worked. :(
I have not tried:
Using an older JRE than 7 (1.7)
Any help would be great.
POSSIBLE (HACK) SOLUTION: What about manual installation? It's what we've opted to do at work. Is it possible to figure out what files are installed (without installing it since I cannot)?
EDIT: I have also verified that "JAI (Java Advanced Imaging) Image I/O" has the same problems on my system.
JAI is only available on 32bit (x86) JRE, so you need to install the 32 bit JRE on Windows 7.
JAI uses some native implementations (dlls) in order to accelerate the processing, so only installs on a 32bit JRE.
When installing JAI, it tries to detect the installed JRE and should be a 32bit JRE. You can install 32bit JRE on a Windows 7 x64, the only "difference" is the performance and the maximum memory available to java applications.
Install JAva 7 JRE 32bit from http://www.oracle.com/technetwork/java/javase/downloads/java-se-jre-7-download-432155.html select "Windows x86 Offline".
Another way is manual installation from JAI as zip, use jai-1_1_3-lib-windows-i586.jar.zip and execute from the 32bit JRE.
install a JRE version 1.3 or later? (and make sure that your PATH points to it)
[edit]
Are you sure there's a problem? It seems that 3 files you downloaded are mutually exclusive (that's what I got from reading the installation instructions)
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jdk.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586-jre.exe
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-windows-i586.exe
Installing -jre or -jdk may be redundant
I installed the jre version and it asked me for a jre directory - any of that happen to you?
[/edit]
try to install (reinstall) java (jre) in folder without any spaces. For example C:\Java\jre7.
You must install 32-bit version of jdk
I solved this problem by installing 32-bit version of jdk.
My OS is window 8 64-bit.
when installing jai-1_1_3-lib-windows-i586-jdk.exe and jai_imageio-1_1-lib-windows-i586-jdk.exe with double clicks, i got the same error "Severe: JRE 1.3 or higher must be installed!"
then I downloaded jdk-7u21-windows-i586.exe and installed it in "c:\Program Files (x86)\Java".
and then it's OK.

Resources