jruby / jruby

JRuby, an implementation of Ruby on the JVM
https://www.jruby.org
Other
3.79k stars 922 forks source link

JRuby 9.3.0.0 Installer for Windows 10 x64 only works with JDK 8 (not JDK 16) #6849

Closed AndyObtiva closed 3 years ago

AndyObtiva commented 3 years ago

I tried to install JRuby 9.3.0.0 on Windows 10 x64 and it complained about not having Java despite having JDK 16 installed. It indicated JDK 8 was the minimum and maximum version the installer worked with.

I worked around this issue by dual-installing JDK 8, and then later changing JAVA_HOME to JDK 16 to make JRuby 9.3.0.0 work with JDK 16.

Environment Information

Provide at least:

Expected Behavior

It should have installed successfully like previous 9.2.x.y Windows installers worked on previous versions of Java, but accepting Java 16.

Actual Behavior

I got a dialog message saying: "The install4j wizard could not find a Java(TM) Runtime Environment on your system. Please locate a suitable 64-bit JRE. (minimum version: 1.8, maximum version: 1.8)"

Screenshot 2021-09-22 161309

mohits commented 3 years ago

hi @AndyObtiva - I'm not fully familiar with the code setup, but I find that message strange because I looked at https://github.com/jruby/jruby/blob/9.3.0.0/install/jruby.install4j#L4 which is the Intall4J project and it seems to be minVersion = 1.7 and no recommended JAVA maxVersion. I will try to see if I can replicate it somehow on my side (my default version of JAVA on Windows 10 here is openjdk version "1.8.0_265"

I was able to change the Java version on the PATH on the command line and then run the EXE installer from there, and was able to see exactly the message that you saw. Let me see if I find where it is specified.

mohits commented 3 years ago

@enebo - I think you maintain the install4j project for JRuby and I'm not sure where the code is. I get the feeling that the code at https://github.com/jruby/jruby/blob/9.3.0.0/install/jruby.install4j is not correct because it points to 1.7 as the dependency and has no Java max version.

I read on this: https://www.ej-technologies.com/resources/install4j/help/doc/concepts/launchers.html that the installer uses the bundled JRE (we don't bundle one any more, I think) or uses the search path[s] to determine which JRE to use. This is configured in the tool.

Let me know if there is something I could help with on this because I feel that this is a blocker for Windows users who have a different JRE (other than 1.8) as the default.

(I looked at commit 1f47c53 but that does not do anything more than change to the v9 version)

enebo commented 3 years ago

@mohits I am certain I have used > Java 8 for installations before. The error message is very interesting though. It could be that when I switched to install4j9 they changed how they interpret the XML (which was generated by a previous version of install4j). I would hope I do not need to update a max java version. That would require periodically updating a file when in most cases nothing would break.

I will try and sort this out today as we want to put out 9.3.1.0 early next week.

mohits commented 3 years ago

Thanks @enebo - I feel the same way also... the only conceivable link is the update you made to use install4j9 and I looked at the help guide and the screenshot does show blank for maxVersion.

By the way, I looked at the log for install4j (set INSTALL4J_LOG=yes and then check %TEMP% for the most recent i4j_nlog_XX.log file) and I found this in the log.

[0:280] Searching for a JVM
[0:280] MinVersion: 1.8, MaxVersion: 1.8
[0:281] Testing location  (type Y)
[0:281] Sharing key: 
[0:281] Testing location JAVA_HOME (type E)
[0:282] checkJavaExe (d:\apps\jdk\jdk-11.0.11_x64\bin\java.exe, [out], 2, 2, 0)
[0:282] file exists
[0:282] got version from registry 11.0.11" 2021-04-2
[0:283] checkJavaExe returning 0

This clearly shows it is looking for minVersion and maxVersion to be 1.8 which is why it is failing after checking the version from Java 11)

Could you check the XML project file to see what it shows? I think the one that is committed in the install directory is not the one that you used (since it specifies 1.7 not 1.8).

If it helps, I can run the installers for 9.2.18 and 9.2.18 with the newer Java. It's just the 9.3.0.0 which fails.

Hope this helps!

enebo commented 3 years ago

@mohits thanks for the offer of help. I already see that somehow I did not save this config file after loading it with install4j9. So large number of format changes. In particular there is a javaMinVersion specified but the javaMaxVersion="" has been removed. I am betting this makes the max unbounded.

enebo commented 3 years ago

So if javaMaxVersion is unset it defers to another value which as you can guess is set to 1.8. I guess this explains the min and max both ending up as 1.8. Without any clear understood way of saying I don't care about max version I set javaMaxVersion="200". Unless they speed up versioning stride of Java I will long be in the ground before we hit that version number.

mohits commented 3 years ago

Hi @enebo - that's fine, I guess. In the screenshot, it shows a possibility to leave it blank but I'm surprised that it resolves to 1.8 (minVersion) in that case. I'm in agreement that for now, 200 is a safe limit though I'm somewhat partial to non-obvious numbers, e.g. 234 but that works also for now.

Thanks for looking into this!