johanjanssen / TemurinChocolateyPackages

Apache License 2.0
3 stars 4 forks source link

FeatureOracleJavaSoft not configured #15

Closed johanjanssen closed 2 years ago

johanjanssen commented 3 years ago

The FeatureOracleJavaSoft flag is mentioned in the description but doesn't occur in any of the scripts.

@RedBaron2 do you know if you left this one out on purpose? Is there a reason it's not there, or can it be added?

RedBaron2 commented 3 years ago

@johanjanssen It was probably just an oversight on my part. It can be added in to the code for next release.

Though by reading the note on the website. It seems to me it only helps upon adoptopenjdk uninstall and install of oracle java.

I'll work on it for later.

johanjanssen commented 3 years ago

Ok, no problem :), it's indeed a bit specific feature and it's the first time I got a comment on it.

Brainded-23 commented 3 years ago

Hopefully I'm doing this right. This is the first time I've tried helping with anything like this.

I created a local copy of the packages with everything identical except the lines I show below, and I can confirm that adding these lines causes the package to behave properly and add the "FeatureOracleJavaSoft" item (which takes care of the registry keys in the install).

The changes I made were to "helper.ps1", and can apply to ALL of the AdoptOpenJDK packages. I added these as lines 52-54:

"FeatureOracleJavaSoft" {
  $pp_addlocal_array += -join ("FeatureOracleJavaSoft", ",")
}

I'm not sure how to add a line break in the code block here, but they follow the same formatting as lines 30-51. Edit: figured out the formatting.

johanjanssen commented 3 years ago

@Brainded-23 looks great, thanks for your help!

@RedBaron2 Andrew tested the change above, maybe you can do a double check to see if other changes are needed? If that's the only thing then I can add it to the script as well. I see the next release is 16 which is scheduled for 2021/03/16. Would be nice if we can fix it before that release. Then it's also available for all the minor Java upgrades in April.

RedBaron2 commented 3 years ago

@johanjanssen I will double check, but from cursory view it looks to be correctly added to the coding.

@Brainded-23 If you would like to submit a PR and list me and @johanjanssen we can check it. Thanks for the assistance.

johanjanssen commented 3 years ago

@Brainded-23 I've created the pull pull request. @RedBaron2 can you review it when you have some time?

johanjanssen commented 3 years ago

@Brainded-23 how did you test it? Because it doesn't seem to work on my machine.

I've tested it with: choco install .\AdoptOpenJDK8.8.282.8.nupkg --params="/ADDLOCAL=FeatureOracleJavaSoft" -dv -s .

But I don't see anything in HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft. I only see things under HKEY_LOCAL_MACHINE\SOFTWARE\AdoptOpenJDK, but they are added regardless of the FeatureOracleJavaSoft option.

RedBaron2 commented 3 years ago

@johanjanssen Did you check under the HKCU/Software area of the registry. Since the feature is specific to the installation of Oracle Java.

It might be specific to the user and not a system wide registry key. -- or -- It might be a case of placing a environment variable.

Really unknown:

My main question is why anyone would go back to Oracle Java after having experienced any of the OpenJDK builds. Then again I don't develop in java now days.

johanjanssen commented 3 years ago

That's a good question. @Brainded-23 why do you need this feature?

Sounds like it isn't used commonly and it might be better to just remove it from the description.

Brainded-23 commented 3 years ago

Gentlemen, please excuse my lack of participation in this. I'm not a developer, I'm a sysadmin. I don't live in GitHub enough and have not really gotten to the point where I understand all the workflows so I was totally lost when you asked me to submit a PR.

Anyway, to provide as much detail and information as possible, here goes. I created a local package (I called it "aojdk8jre-csg") in our own repository, with only the one change I indicated above. Then I install that using the following command:

choco install aojdk8jre-csg --params="/ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome,FeatureOracleJavaSoft"

I can confirm that this does in fact create keys and values: HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.8 (contains JavaHome and RuntimeLib values) HKLM\SOFTWARE\JavaSoft\Java Runtime Environement\8.0.282.8 (contains the same values)

Also, if I add the "INSTALLDIR" option, it breaks so I leave that off and it installs in the default folder (C:\Program Files\AdoptOpenJDK).

As for WHY, first of all it is broken. A degree of OCD led me to look for a fix. I discovered that if I used install arguments instead of parameters (this passes the options to the MSI directly instead of the package script) it worked, which caused me to dig around to figure out why the package script did not. Second, we do have one app that doesn't work if the JavaSoft keys are not there. I realize this is not a widely needed option, but if it's broken and there is an easy fix, why not include it?

johanjanssen commented 3 years ago

Thanks for the explanation @Brainded-23, for whatever reason it doesn't work on my machine. On the other hand I assume it doesn't break anything either. So I'll add the fix. Thanks for your help. I believe that new Java updates are scheduled for April, then this feature will be included.

Brainded-23 commented 3 years ago

Thank you.

I noticed in your post above that in your testing you were using ONLY this one feature. I don't know enough about the package itself to say this for sure but it's possible it requires one of the other features (FeatureMain maybe?) in order to do anything. I have not tested it by itself or iterated through the combinations of features to see what works and what does not.

johanjanssen commented 3 years ago

Thank you for trying to help, but I've tested it today with the same params as you mentioned in your post. Unfortunately, it still didn't work. Maybe some weird company policy on my laptop or something like that.