Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Java path to registry #119

Open
issaclin32 opened this issue Jan 20, 2020 · 5 comments
Open

Adding Java path to registry #119

issaclin32 opened this issue Jan 20, 2020 · 5 comments

Comments

@issaclin32
Copy link
Member

Some applications, such as Keystore Explorer[extras/keystore-explorer] and Minecraft[games/minecraft], checks Java installation through registry.

Therefore when user installs JRE through Scoop, these applications will report "Java is required" even if JRE is already installed.

The problem can be fixed by importing the content below. This can be implemented by following the pattern of VSCode package. vscode.json / vscode-install-context.reg

(I am not an expert, so I am not really sure about whether this should be added to all JRE/JDK packages.)

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="1.8"
"BrowserJavaVersion"="11.241.2"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8]
"RuntimeLib"="(JAVA PATH)\\bin\\server\\jvm.dll"
"JavaHome"="(JAVA PATH)"
"MicroVersion"="0"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0_241]
"JavaHome"="(JAVA PATH)"
"MicroVersion"="0"
"RuntimeLib"="(JAVA PATH)\\bin\\server\\jvm.dll"
@nklowns
Copy link

nklowns commented May 7, 2020

When you install adoptjdk on the official website these regkey are created
I renamed them to reflect the scoop and it worked

adopt8-openj9

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8]
"JavaHome"="c:\Users\MyUser\scoop\apps\adopt8-openj9\current"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\8.0.252.09]
"JavaHome"="c:\Users\MyUser\scoop\apps\adopt8-openj9\current"

adopt11-openj9

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JDK\11]
"JavaHome"="c:\Users\MyUser\scoop\apps\adopt11-openj9\current"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JDK\11.0.7.10]
"JavaHome"="c:\Users\MyUser\scoop\apps\adopt11-openj9\current"

@se35710
Copy link
Collaborator

se35710 commented May 7, 2020

Thank you.

My own findings were that you don't need the full version as a regkey, but just the major version. But I have not been able to test it enough to implement it yet.

There are a couple of other issues too:

  1. If the full version is needed, when a new release is made, cleaning up the registry could have implications if other Java distributions are installed.
  2. If multiple Java distributions are installed within the same major release (say JDK 11), which one should be in the registry?
  3. If Java is installed globally (scoop install -g), and then one user installs it locally (in it's own profile directory), which should take preference?
  4. If Java is installed locally, for all other users on the same computer who want to use Java, what are their options?
  5. scoop reset does not take into account registry keys, so switching Java would still leave old regkeys intact.

@nklowns
Copy link

nklowns commented May 11, 2020

@se35710
Perhaps creating a syslink folder JAVA_PATH for the current java, so whatever java is installed, the path
will be immutable and, therefore, globally will assume that folder over the locally installed.

@moracabanas
Copy link

moracabanas commented Sep 4, 2020

If I want to execute a .jar file with JDK or JRE installed from scoop, there is no file assosiation and, if you try to execute it by java it wont work as .jar needs "javaw -jar ffilename.jar".
Hope java bucket add this file association as I don't want to mess with the registry mannually

@schmitzCatz
Copy link

Since this issue is still open I'll post .reg file for other to fix file association:

[HKEY_CLASSES_ROOT\.jar]
@="jarfile"

[HKEY_CLASSES_ROOT\jarfile]
@="Executable Jar File"

; Modify the path to javaw.exe below if using a different version or JRE
[HKEY_CLASSES_ROOT\jarfile\shell\open\command]
@="\"C:\\Users\\oschm\\scoop\\apps\\liberica17-jdk\\current\\bin" -jar \"%1\" %*"

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants