Содержание
- Что делать? Устанавливать или нет?
- this application requires a java runtime environment (different POV) #238
- Comments
- dhamann commented Jul 20, 2020 •
- aahlenst commented Jul 20, 2020
- hendrikebbers commented Jul 20, 2020
- dhamann commented Jul 20, 2020
- hendrikebbers commented Jul 20, 2020
- hendrikebbers commented Jul 20, 2020
- hendrikebbers commented Jul 20, 2020
- dhamann commented Jul 20, 2020
- dhamann commented Jul 20, 2020
- aahlenst commented Jul 21, 2020
- douph1 commented Jul 21, 2020
- dhamann commented Jul 21, 2020 •
- dhamann commented Jul 21, 2020 •
- dhamann commented Jul 21, 2020
- douph1 commented Jul 21, 2020
- douph1 commented Jul 21, 2020
- douph1 commented Jul 21, 2020
- dhamann commented Sep 13, 2020 •
- aahlenst commented Sep 14, 2020
- ttimasdf commented Feb 24, 2021 •
Что делать? Устанавливать или нет?
При запуске приложения Snaz вместо приложения, выскакивает табличка:
This application requires one of the following versions of the .NET
Framework:
.NETFramework,Version=v.4.5.2
Do you want to install this .NET Framework version now?
При нажатии ДА, перекидывает на сайт и скачивается программа NDP462-KB3151802-Web.exe
Что делать если эта ошибка? Предупреждения:
Программа установки может не работать надлежащим образом, поскольку на этом компьютере недоступна служба Центра обновления Windows.
Что делать если эта ошибка? Предупреждения:
Программа установки может не работать надлежащим образом, поскольку на этом компьютере недоступна служба Центра обновления Windows.
Что делать если эта ошибка? Предупреждения:
Программа установки может не работать надлежащим образом, поскольку на этом компьютере недоступна служба Центра обновления Windows.
Что делать если эта ошибка? Предупреждения:
Программа установки может не работать надлежащим образом, поскольку на этом компьютере недоступна служба Центра обновления Windows.
ТОЛЬКО СЕГОДНЯ И ТОЛЬКО ДЛЯ ТЕБЯ ПЕРЕВОЖУ ТЕКСТ В ОНЛАЙН ПЕРЕВОДЧИКЕ БЕСПЛАТНО.
This application requires one of the following versions of the .NET
Framework:
.NETFramework,Version=v.4.5.2
Do you want to install this .NET Framework version now?
Для этого приложения требуется одна из следующих версий .NET
Фреймворк:
.NetFramework, Version = v.4.5.2
Вы хотите установить эту версию .NET Framework сейчас?
Источник
this application requires a java runtime environment (different POV) #238
TL;DR: How to handle registry magic when using zip distribution? (for example after installing via scoop installer)
I do not know where to address my question (am aware this repo is for the installer), please be kind if you think this is the wrong place. i am open to recreating this issue somewhere else seen better fitting. but as i found the personally most fitting issue in this repo that is handling technicalities concerning the openjdk windows registry stuff i thought i post this issue here.
With issue #64 you created a way to use the installer to handle the registry magic . which is great! only i do not use the manual installer but use scoop to install java. scoop does not use the msi installer but extracts the zipped distribution . is there a way to reproduce the things the installer does concerning creation of the the required registry entries?
If there currently is no way . could the functionality be transformed to a utility that could be distributed inside the zipped distribution?
The text was updated successfully, but these errors were encountered:
JAVA_HOME is an environment variable an can be set using the GUI. Enter «environment variable» into the search field of Windows and the right option should pop up. The registry entries can be created manually using regedit. See https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-microsoft-windows-platforms.htm#JSJIG-GUID-47C269A3-5220-412F-9E31-4B8C37A82BFB for the entries common Java software expects.
I assume setting JAVA_HOME is not the part that was asked here. If I understand @dhamann correctly he wants to add the JAR mimetype to be executed by Java for example. Is that right?
hi both of you, @aahlenst you are thinking in the right direction, @hendrikebbers you too!
. actually i would like to be able to do the stuff the installer does to the registry by running a utility that sets the values for the version that is distributed with the zip file.
running a jar via doubleclick is one use case, another would be running an executable file generated by launch4j
@aahlenst i probably would need to do the stuff you pointed me to . for every installed java version and for every next coming update again? how do other people using the zipped distribution handle this? (please point me to a better target for my question if the openjdk-installer repo is a not fitting place for this, i just do not know where to ask)
Is scoop like home-brew for windows? The project has 11k stars on GitHub. Maybe we should think about providing a script for scoop?
Looks like this is already available: https://github.com/ScoopInstaller/Java
Maybe the scripts just do not everything that the installer does. Looks like it sets the JAVA_HOME env but does no windows registry mutations: https://github.com/ScoopInstaller/Java/blob/master/bucket/adopt11-hotspot.json
ScoopInstaller/Scoop#3412 Scoop does not provide registry support at the moment.
hmm . i just tried it with the current installer . and it is like i want everything except the root node 🙂
would it be possible to put all the sub-entries of the root node in a second node that just sets the configuration? It could use the path supplied like shown in the screenshot below (i just painted that as a suggestive idea, the current dialog is also shown BELOW for reference)
Idea for different Dialog (two root nodes):
Current Dialog (one root node):
JAVA_HOME is an environment variable an can be set using the GUI. Enter «environment variable» into the search field of Windows and the right option should pop up. The registry entries can be created manually using regedit. See https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-microsoft-windows-platforms.htm#JSJIG-GUID-47C269A3-5220-412F-9E31-4B8C37A82BFB for the entries common Java software expects.
hi @aahlenst the supplied info in the deep link is probably just the tip of the iceberg, i suppose? would i not also need some kind of reg entry for the directory that this keys point to? orcl url sadly does not mention anything like that there
dear @douph1 please excuse my «pulling you in» by mentioning . i read your very informative comments (for example: #64 (comment)) . currently the installer executes logic to manipulate registry values directly, right? (via wix-tooling?)
Could the installer maybe also create windows cmd / batch files that make it possible to re-execute that same registry-setting commands for the specific version? (although I just peeked into douph1@c79c7e8 and that seems rather complicated 🙂 ) Thank you for putting your time into this solution there, btw. Seems really challenging to find «the right» solution!
I’m not yet sure what the exact problem is. Therefore it is hard to recommend something and even more so to take action.
What do you want to achieve? Beyond applying «registry magic» to the ZIP files? Do you need multiple Java versions and an easy way to switch between them? Why is using an MSI not an option?
To write «Oracle Java Key» you must write to
HKLM only ( be root required )
The key path is based on :
- Major version (1.8 or later)
- JRE vs JDK
- know if you use Wow > Wow6432Node
But a key must not be overridden with an older key ( always pointed to the latest/newest Java )
As it depends of the version intended to be installed and already installed, just write reg key without the binary is useless and or/copy/paste reg key from one host to another is a bad idea.
.jar and .jnlp apply to HKMU (switches between hklm and hkcu depending on machine or user installation)
.jnlp apply only to Java 8
Adding/splitting the installer features in two groups will break actual feature level compatibility. So no
You can probably use a tool to monitor wich reg key is written by the installer
https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
and then extract this key as registry patch
or create a list of command with https://docs.microsoft.com/fr-fr/windows-server/administration/windows-commands/reg-add
I’m not yet sure what the exact problem is. [. ]
Reproducing the windows registry settings that get set by the installer after having extracted (either by hand or by using a tool like scoop) the zip-distribution.
What do you want to achieve? [. ] Do you need multiple Java versions and an easy way to switch between them?
Why is using an MSI not an option?
it is an option. i can do it via the installer. i thought there might already exist a way to have every needed jdk installed and switch the windows registry settings separately.
To write «Oracle Java Key» you must write to
[. ]
[. ]
.jnlp apply only to Java 8
@douph1 thank you for all the input!
Adding/splitting the installer features in two groups will break actual feature level compatibility. So no
snap, i liked the idea 🙂
yes, that is what i tried yesternight . i tried to use a tool called regshot, which produced a bit too much noise (many background regchanges also in delta result) . hmm .
would you maybe be able to suggest relevant reg-branches i should monitor for changes, @douph1 ? I currently built the following reg-file . and am trying now to switch the current version. But i probably have not grasped the picture well enough.
but what about [HKLMSOFTWAREWOW6432NodeJavaSoft]? Do i need both? (Win10 Pro x64)
I am starting to fear this rabbit hole.
A batch file supplied with the zip distro that sets the right entries is probably also too complicated?
//last edit: please excuse the edit-storm. it has ended now.
i re-read the commandline parameter section of https://adoptopenjdk.net/installation.html#windows-msi and tried a different angle (and already thought bad of me not having thought of that before)
I tried to omit the FeatureMain option when calling the msi-installer . so for example:
could maybe have done everything except installing files to target dir. But that did not produce the envisioned result.
uh this is hard.
but what about [HKLMSOFTWAREWOW6432NodeJavaSoft]? Do i need both? (Win10 Pro x64)
no. it is intended for Java 32 on Win 64
Your title «this application requires a java runtime environment» seems linked to «launch4j»
and as mentionned in #64 launch4j can but don’t rely on JAVA_HOME by default.
By default it look only onto JavaSoft
so you must look/create (depending of the java version)
«CurrentVersion» on
- HKEY_LOCAL_MACHINESoftwareJavaSoft JRE
or/and - HKEY_LOCAL_MACHINESoftwareJavaSoft Java Runtime Environment (for 1.8)
and/or - HKEY_LOCAL_MACHINESOFTWAREJavaSoft JDK
and/or - HKEY_LOCAL_MACHINESOFTWAREJavaSoft Java Development Kit (for 1.8)
into a subkey corresponding to this «CurrentVersion»
create a key «JavaHome» with the JAVA_HOME ( = INSTALLDIR (without bin ) )
and eventually (but I don’t know if launch4j required it ) «RuntimeLib» if it is a JRE with the DllPath as here https://github.com/douph1/openjdk-installer/blob/master/wix/Includes/OpenJDK.Variables.wxi
and for file association with exe you must certainly look at microsoft documentation if you intended to rewrite all the magic as Wix-installer does
Just to name a «magic» thing ..
https://stackoverflow.com/questions/51715292/best-way-to-get-file-type-association-in-windows-10-from-command-line
on systems running Windows 8 or later
..a new registry key was introduced and Windows now writes the user choice to
«UserChoice»
HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER
Both the «App Paths» and «Applications» registry subkeys are used to register and control the behavior of the system on behalf of applications. The App Paths subkey is the preferred location.
I’m even not sure if WIX/our usage of WIX installer use the new «App Paths» reg key
as I have already seen that .jar file association don’t work always.
After some weeks of inactivity i just re-read the whole thread and with this issue still being open i feel a bit of «something to do left» . so i would like to mention the rather hidden question of «my opening post» and leave the action of closing or further working on/with something to you. (You could also ask me to close it if that is the way to go)
If you think that this (something executable that would be included in the zip distribution) would be something that might be creatable . should i create a new issue asking for relating to just that (and relating to this issue as documentation of the thought process)?
In my first post i asked
«. is there a way to reproduce the things the installer does concerning creation of the the required registry entries?»
and in hindsight i might have clarified that i was not thinking of crafting the reproduction myself but that something like an executable script (or something similar) already might exist that would be included in each zip distribution.
@douph1 thank you especially for the last three thorough replies! Via your input i now have a better understanding of the windows client side peculiarities of the jre/jdk installation. Or the challenges applications have to find out about the configured java binaries to run with.
Thanks, too, to everyone who took the time to inspect this Issue. 🙂
If you really want to, you can create a PowerShell or batch script that does the registry alterations. But why? If you want that kind of automation, the MSI has you covered and even provides multiple safeguards you had to re-implement in the script. With something like scoop in the mix, it gets really hairy because you need to remove/update those entries. This is something that has to be solved by the application that manages you JDK installations.
For the record: I don’t think it makes sense for scoop or a similar tool to use the MSIs. VS Code does it and judging by the bug reports we get here, this wasn’t the right choice. If your tool does version management of JDKs, let your tool handle the registry stuff.
I just do some reverse engineering to a 32 bit executable produced by java. In fact, it just iterate over a hardcoded list of Registry path and iterate the subkeys inside it. and any one of them exists, it will work. The CurrentVersion key is in fact not check at all. The executable check the subkey name as version string, that ANY version above 1.8.0_45 will work so I randomly choose 1.11
So, All I need is put the following content inside a javahome.reg file, and double click it. and all exes requiring java works smoothly from now on.
You may tweak it a bit to suit your scenario. My openJDK version is jre-15.0.2.7-hotspot . besides, 64 bit or 32 bit doesn’t matter at all, so don’t care about WOW6432Node
Part of the list that any java executable will checked through:
Источник
Не могу разобраться с Java Runtime Environment
Нашёл на просторах интернета интересную прогу — Alchemy. Если вкратце — генератор творческого беспорядка чтобы далее его «упорядочить» и что-то из этого создать. Или же когда охота порисовать, а идей в голове нет.
Работает она на Java. И в этом проблема. При запуске она мне пишет:
«This application requires a Java Runtime Environment 1.5.0
И один вариант ответа — Ok.
Хотел прикрепить картинку, но она почему-то не прогружается.
И я не понимаю, что она от меня хочет. При нажатии на Ok кидает на сайт установки Java. Я скачиваю оттуда новую версию (8 211), но к иному результату она не приводит.
Я так понимаю, мне нужно найти именно Java Runtime Environment? Или тут проблема в другом?
Вопрос решён. Решением послужило удаление предыдущей Java и установка 64-битной версии. Большое спасибо за помощь Тимуру Богданову
I have Launch4j and JDK installed on my computer and I am trying to convert jar-file to exe. When I start Launch4j I get the following error:
This application requires a Java Runtime Environment 1.6.0
How can I fix this? What is the Launch4j search strategy to find installed jres/jdks?
JDK version:
java -version
Output:
java version «14» 2020-03-17 Java(TM) SE Runtime Environment (build
14+36-1461) Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed
mode, sharing)
I have JDK-path in both variables PATH and JAVA_HOME. I tried to uninstall the JDK and install JRE, but I first need to compile *.java to *.class files with the javac command. So in this case I have different versions of JDK and JRE.
The official documentation says:
Launch4j requires an xml configuration file for each output
executable.
So I can use jre tag with jdkPreference attribute to specify a preference for a public JRE or a private JDK runtime in configuration file. But how can I add this to build.xml file?
build.xml:
<project name="launch4j" default="compile" basedir=".">
<property name="src" location="src" />
<property name="lib" location="lib" />
<property name="build" location="build" />
<property name="jar" location="./${ant.project.name}.jar" />
<property name="launch4j.dir" location="." />
<property name="maven" location="maven" />
<path id="dist.classpath">
<pathelement path="${build}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="init">
<tstamp />
<mkdir dir="${build}" />
</target>
<target name="compile" depends="init" description="compile the source">
<javac srcdir="${src}" destdir="${build}" classpathref="dist.classpath" source="1.6" debug="on" includeantruntime="false" />
<copy todir="${build}/images">
<fileset dir="${src}/images">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${build}">
<fileset dir="${src}">
<include name="**/*.properties" />
</fileset>
</copy>
</target>
<target name="jar" depends="compile" description="create jar">
<fileset dir="${lib}" id="lib.dist.fileset">
<include name="**/*.jar" />
</fileset>
<pathconvert pathsep=" " property="dist.classpath" refid="lib.dist.fileset">
<map from="${lib}" to="./lib" />
</pathconvert>
<!-- Put everything in ${build} into a jar file -->
<jar jarfile="${jar}">
<fileset dir="${build}" excludes="**/messages_es.properties" />
<manifest>
<attribute name="Main-Class" value="net.sf.launch4j.Main" />
<attribute name="Class-Path" value=". ${dist.classpath}" />
</manifest>
</jar>
</target>
<target name="demo" depends="jar" description="build the demos">
<ant dir="./demo/ConsoleApp" inheritAll="false" />
<ant dir="./demo/SimpleApp" inheritAll="false" />
</target>
<target name="clean" description="clean up">
<delete dir="${build}" />
<delete file="${jar}" />
<ant dir="./demo/ConsoleApp" target="clean" inheritAll="false" />
<ant dir="./demo/SimpleApp" target="clean" inheritAll="false" />
</target>
<target name="switch-to-maven" description="switch project to maven">
<copy todir="." overwrite="true">
<fileset dir="${maven}">
<include name="**/*" />
</fileset>
</copy>
<delete dir="${lib}" />
<mkdir dir="./target" />
</target>
</project>
Thanks
Try these fixes to resolve Java Runtime Environment not found error
by Vlad Turiceanu
Passionate about technology, Windows, and everything that has a power button, he spent most of his time developing new skills and learning more about the tech world. Coming… read more
Updated on September 19, 2022
Reviewed by
Vlad Turiceanu
Passionate about technology, Windows, and everything that has a power button, he spent most of his time developing new skills and learning more about the tech world. Coming… read more
- A Java Runtime error might appear if you have installed an older JRE software.
- If you have wondered how to fix Java issues, reinstalling it can help you.
- To fix the Java Runtime Environment not found error, make sure to have the latest version of Java.
- Download the JRE version that corresponds with your system type so you won’t deal with other types of Java issues.
XINSTALL BY CLICKING THE DOWNLOAD FILE
This software will repair common computer errors, protect you from file loss, malware, hardware failure and optimize your PC for maximum performance. Fix PC issues and remove viruses now in 3 easy steps:
- Download Restoro PC Repair Tool that comes with Patented Technologies (patent available here).
- Click Start Scan to find Windows issues that could be causing PC problems.
- Click Repair All to fix issues affecting your computer’s security and performance
- Restoro has been downloaded by 0 readers this month.
The Java Development Kit (JDK), the Java Virtual Machine (JVM), and the Java Runtime Environment (JRE) form a trio of Java platform components for developing and running Java apps.
A runtime environment is a piece of software designed to run other software. For example, as the runtime environment for Java, the JRE contains the Java class libraries, the Java class loader, and the JVM.
So if you don’t have JRE installed or you have an older version of the software, you might encounter one of the following messages:
- Error: Could not find Java SE Runtime Environment – you don’t have the Java SE version installed on your system
- This application needs version 1.x or higher of the Java Runtime Environment – you should update your Java version to the latest you can find on the official website
- A Java Runtime Environment(JRE) or Java Development Kit (JDK) must be available to run this app – like the first error, check if you have installed JRE or JDK and if not, install them
Today’s guide will explore the most efficient and easy methods to resolve the Java Runtime Environment not found and the other similar errors with Java. Read on for more details.
Why is JRE not installed?
In Windows and macOS, installing the Java Developmental Kit (JDK) in previous releases optionally installed a Java Runtime Environment (JRE).
However, with JDK 11, Oracle removed JRE to be installed optionally. Therefore, with JDK 11 release, the JRE or Server JRE is no longer offered, and only the JDK is provided.
Also, the Java Runtime Environment not found it could be caused by several other reasons, which we have listed below.
- Java is not installed on your PC.
- Java installation was not completed due to some errors.
- The environment variables of Java are not set.
- You might have more than one Java Runtime installation.
- A Windows misconfiguration can also trigger this problem.
How do I fix the Java runtime environment not found?
1. Run Windows troubleshooter
- Select Start, and click on Settings.
- Choose Update & Security, and then click Troubleshoot.
- Select the type of troubleshooting you want to run, then select Run the troubleshooter.
- Allow the troubleshooter to run and then answer any questions on the screen.
Some PC issues are hard to tackle, especially when it comes to corrupted repositories or missing Windows files. If you are having troubles fixing an error, your system may be partially broken.
We recommend installing Restoro, a tool that will scan your machine and identify what the fault is.
Click here to download and start repairing.
You can try the recovery options if you see a message that no changes or updates are necessary. This is a built-in troubleshooter tool from Windows 10.
2. Download Java Runtime Environment (JRE)
- Download JRE from the official website.
- Choose if you need a 32bit or a 64bit architecture of JRE based on your PC specifications.
- Click on the Agree and download button to start the actual download.
If you don’t know which version of Java is the correct version for your system, you can find out by searching in the Start menu the term System Information.
It would be best if you opened the first option that appears after the search and then checked the value under System Type (32-bit or 64-bit).
- Could not create the Java virtual machine [Fixed]
- Runtime Error R6025: Fix it With These 4 Easy Solutions
- What is Segmentation Fault: 11 & How to Fix it
- Could Not Create the Java Virtual Machine: 4 Easy Fixes
- How to Fix ADB Command Not Found or Inaccessible [5 Ways]
3. Install Java Runtime Environment (JRE)
- Right-click on the downloaded JRE setup file.
- Select Run as administrator and accept the installation prompt.
- Click on the Install button to complete the installation.
- You will receive a message that the installation was successful. Next, click on close the complete the installation and close the window.
We recommend you check if there is a new Java update each time you encounter this issue. Unfortunately, the software will not update automatically, so you must perform this task manually.
How can I fix Java Runtime Environment not found on Windows 11?
The above solutions also work perfectly well for Windows 11 PC. So, to summarize the answers, here’s what you can do to fix the Java Runtime Environment not found on Windows 11.
- Uninstall all Java versions from your PC and install the latest one from the official website.
- Configure the Environment Variables for Java on your PC.
- Reset your PC.
- Check for viruses or malware.
Where is JRE located?
- Open the Start menu.
- Click on Control Panel.
- Select Java.
- Switch to the Java tab.
- Click View.
- Check the Path column for the version of the JRE you have installed.
- You will see a path. For example
C:appsjdkjrebinjavaw.exe
- So, the path is
C:appsjdkbin
That is it. You should now have the latest version of Java Runtime Environment on your PC and no longer receive the error message.
Please write us in a comment below if these solutions helped you or if there are any other suggestions that we should include in our article.
Still having issues? Fix them with this tool:
SPONSORED
If the advices above haven’t solved your issue, your PC may experience deeper Windows problems. We recommend downloading this PC Repair tool (rated Great on TrustPilot.com) to easily address them. After installation, simply click the Start Scan button and then press on Repair All.
Newsletter
Описание проблемы
Всё работало до момента когда я изменил версию .NET Framework на 4.7.2. После этого появилась такая ошибка при запуске:
This application requires one of the following versions of the .NET Framework:
.NET Framework, version=4.7.2
Do you want to install this .NET Framework version now?
Я подумал — фиг с ним, установил. Но нет, ничего не изменилось, всё ещё требуется установка. «Восстановил» в установщике, перезагрузил компьютер — ничего не помогло. Ошибка всё ещё тут. Нужная версия .NET Framework в списке программ есть.
задан 3 авг 2019 в 9:19
2
Я бы не называл это решением проблемы. Я бы не называл бы даже это правильным выбором, потому что это именно уклонение от решения проблемы.
Тем не менее мои проблемы решила смена на более новую версию .NET Framework, а конкретно на уже установленную 4.8. Если кому-то интересно, как я «додумался» до этого, то меня на это натолкнуло вот это из оф. документации Microsoft (статья: https://docs.microsoft.com/en-us/dotnet/framework/install/troubleshoot-blocked-installations-and-uninstallations)
Because the 4.x versions of the .NET Framework are in-place updates, you cannot install an earlier version of the .NET Framework 4.x on a system that already has a later version installed.
ответ дан 3 авг 2019 в 19:07
loxlesha
Путешественник
- С нами
- 14 Июн 2019
- Сообщения
- 4
- Реакции
- 1
-
#1
Это мне вылезает когда я пытаюсь открыть лаунчер если я нажимаю на него перекидывает на сайт Java,где там предлагают её скачать,очень много раз скачивал но теперь сама Java не запускается и не могу до сих пор зайти в лаунчер
ZeeM
Путешественник
- С нами
- 26 Май 2018
- Сообщения
- 49
- Реакции
- 30
-
#2
Вам нужно удалить старую версию java, скачав новую.
HappySonic
Кандидат в Мастера Покемонов
- С нами
- 13 Июл 2017
- Сообщения
- 8
- Реакции
- 6
-
#3
Удаляете через панель управление Джаву (программы и компоненты), потом устанавливаете jdk джаву по ссылке https://pixelmon.pro/start для своей ОС, и потом выделяете память в настройках лаунчер
Последнее редактирование модератором:
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
Closed
kriegaex opened this issue
Oct 17, 2016
· 50 comments
Comments
C:\Users\xxx>java -version
openjdk version "1.8.0_72"
OpenJDK Runtime Environment (Zulu 8.13.0.5-win64) (build 1.8.0_72-b15)
OpenJDK 64-Bit Server VM (Zulu 8.13.0.5-win64) (build 25.72-b15, mixed mode)
When running the kse.exe on Windows as installed by your installer, I get a popup error message. Maybe the tool has problems finding the JRE because it specifically looks for Oracle JDK instead of OpenJDK, I have no idea. When running from the command line with java -jar kse.jar
it works nicely.
KSE uses launch4j under Windows. As far as I know, launch4j searches the usual installation paths for a Java runtime. And it probably assumes the Oracle standard folder names.
What you can do as a workaround: Create a copy of the JRE folder in the KSE installation folder and rename it to «jre». That’s the path where launch4j/KSE searches first.
skirankumars31 reacted with hooray emoji
Would you mind re-testing this issue and, if necessary, file an upstream ticket at launch4j? OpenJDK is a relevant platform, I guess.
Is OpenJDK really relevant on Windows? There are no official builds for Windows, the Zulu builds are only 64bit and it’s quite cumbersome to compile OpenJDK on Windows.
Anyway, I’ll try to re-produce this issue and see what can be done about it.
I am currently coaching a Scrum team in the German bank industry. Because OpenJDK is used in production on Linux, all developers also use OpenJDK (Zulu) on their Windows workstations. So much for relevance. But I admit, this is just one project, I cannot speak for the rest of the software development world. Feel free to do whatever seems appropriate. Thank you for your swift response and for kindly considering our situation.
Okay, so I have checked the source code of launch4j and it searches the registry (not the file system) for entries from Oracle and IBM:
«SOFTWARE\JavaSoft\Java Runtime Environment»
«SOFTWARE\JavaSoft\Java Development Kit»
«SOFTWARE\IBM\Java2 Runtime Environment»
«SOFTWARE\IBM\Java Development Kit»
However, the Zulu installer creates the following registry entry:
«SOFTWARE\Azul Systems\Zulu»
There is already a feature request to add support for Zulu OpenJDK to launch4j:
https://sourceforge.net/p/launch4j/feature-requests/103/
It might help to comment on the feature request, so the author of launch4j notices that there is not only one user that wants this feature.
Also, as I have already mentioned, there is always the option to copy the jre folder into the KSE folder. KSE then uses this local runtime preferredly.
I know this is an old issue but since it is still relevant here is my solution:
Create a registry file with the following content and import it into your regsitry
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit]
"CurrentVersion"="1.8"
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8]
"JavaHome"="C:\\Program Files\\Zulu\\zulu-8"
"MicroVersion"="0"
Obviously change the JavaHome
to your Zulu installation. So far this works quite well for me.
ghost
mentioned this issue
Jan 28, 2019
Hi,
@chhe your version did not work for me, im running windows 10 Pro 64bit and i needed to change your workaround like so:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Java Runtime Environment]
"CurrentVersion"="11.0"
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Java Runtime Environment\11.0]
"JavaHome"="C:\\Users\\thomas\\scoop\\apps\\adoptopenjdk-openj9\\current"
"MicroVersion"="0"```
this works for me.
On Windows, one possible solution is to create a directory link inside the KSE installation directory using the cmd.exe
built-in mklink
command (available in Vista/Server 2008 or newer); e.g.:
cmd /c mklink /d "C:\Program Files (x86)\KeyStore Explorer\JRE" "C:\Program Files\AdoptOpenJDK\JRE"
(change paths as appropriate, of course)
Is OpenJDK really relevant on Windows?
Now that Oracle is forcing corporate JRE users to a subscription model, yes it is.
I’ve tested the AdoptOpenJDK JRE 8 distribution and it seems that KSE works with it without any problems. (Launch4j doesn’t support it yet, but that’s a separate problem.)
The MSI installer of AdoptOpenJDK’s Java 8 distribution has an option to add registry entries that are compatible with Oracle’s JDK (under HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit
):
If this option is selected launch4j (kse.exe) finds the AdoptOpenJDK installation and starts KSE just fine.
This is a new feature they have added to the AdoptOpenJDK MSI installer that didn’t exist when I posted earlier. This is good to know — thanks.
I tried Bill Stewart’s solution And it works OK with my OpenJDK 11 installation. I think it might be implemented in KeyStore Explorer’s setup. Something like «where is yout Java installation?».
Caveat: The 32-bit Launch4j will not detect the Oracle registry entries added by the 64-bit AdoptOpenJDK installer (you would have to install the 32-bit version of the JDK/JRE). But again: This is not KSE’s problem at all, but rather an issue with Launch4j. I have worked around this by creating a «launcher» script that uses the JAVA_HOME environment variable and launching javaw -jar kse.jar
.
Caveat: The 32-bit Launch4j will not detect the Oracle registry entries added by the 64-bit AdoptOpenJDK installer (you would have to install the 32-bit version of the JDK/JRE).
That’s not true. Launch4j has a configuration option called «runtimeBits», which determines which registry paths are checked for JRE locations:
runtimeBits
Optional, defaults to 64/32; Allows to select between 64-bit and 32-bit runtimes.
For KSE it’s the default, which means both 64 bit and 32 bit Java runtimes are found.
I tried Bill Stewart’s solution And it works OK with my OpenJDK 11 installation. I think it might be implemented in KeyStore Explorer’s setup. Something like «where is yout Java installation?».
Then KSE won’t start anymore when the JRE location changes. The right place for detecting the JRE is the launcher. There has already been a patch provided for launch4j which solves this problem, but we’ll have to wait for the next release of launch4j.
That’s not true. Launch4j has a configuration option called «runtimeBits», which determines which registry paths are checked for JRE locations…For KSE it’s the default, which means both 64 bit and 32 bit Java runtimes are found.
Oddly, on one system, the registry values weren’t there even though the feature was selected in the installer. Repairing the AdoptOpenJDK JRE installation fixed the problem and indeed kse.exe works as needed even though only the 64-bit values are added. This is good. Thanks for the follow-up.
Now, of course, it’s requiring 1.8 in a day where OpenJDK 15 is released. Why don’t you set a minimum version with no maximum, instead of a specific version?
This is a problem. Becouse I have both 1.8 and 15 installed.
And if I click on JAR file it opens and works correctly with 15 AdoptOpenJDK
kaikramer
added a commit
that referenced
this issue
Nov 21, 2020
@lawrence-dol Java 1.8 is the minimum version. KSE works perfectly fine with Java 15. You just have to check the option to create the registry entry when installing AdoptOpenJDK as described on the download page.
@Mart-Bogdan Did you follow the instructions on the download page of KSE or a few comments above in this ticket (#52 (comment))?
As the launch4j project seems to be pretty dead (no release for more than two years), I have replaced launch4j with my own Windows launcher that uses the JAVA_HOME environment variable.
If you want to try the new launcher, you can download a beta version here:
kse.zip
Just replace kse.exe in your KSE installation with the file from the ZIP file.
The next release of KSE will include this new launcher.
@kaikramer
@lawrence-dol Java 1.8 is the minimum version. KSE works perfectly fine with Java 15. You just have to check the option to create the registry entry when installing AdoptOpenJDK as described on the download page.
Fair enough, though I already knew that from running it with JDK 15 using the -jar
command line form. In my defense, I was believing the loader, which states, «This application requires a Java Runtime Environment 1.8.0», not «This application requires Java Runtime Environment 1.8.0 or later». The former is exact, the latter is a minimum.
For a while I was mistakenly under the impression that the loader was needed instead of being a mere convenience, and that the software require exactly that version. It would probably help the situation to include a basic command line in the «Running» section, along with a statement along the lines of «KSE can be run by simply launching the JAR or by using the Windows executable. blah blah blah».
Regardless, thanks for the program — it’s excellent and the loader issue is, in the end, a minor irritation at worst. I do appreciate your efforts and did not mean to sound ungrateful.
My recommendation on this front is that the launcher should perform several searches for increased robustness.
-
Search
HKLM\SOFTWARE\JavaSoft
subkeys for highest version number and useJavaHome
value. -
Use value of
JAVA_HOME
environment variable. -
Use value of
JRE_HOME
environment variable. -
Search the path for
javaw.exe
and use parent of parent subdirectory name.
In addition, the installer could create a JRE symlink in the application directory to the correct path.
FWIW I built an Inno Setup (IS) installer for KSE that adds the above features. The IS installer compiles to a bit larger size than NSIS but it looks and acts better (IMO) and can be localized fairly easily. (Let me know if you’re interested.)
In thinking about this a bit more, I wrote a launcher executable that uses a kse.ini
file (same directory as .exe file) that looks like this:
[JavaHome]
Path=C:\Program Files\AdoptOpenJDK\JRE11
The launcher uses this path to launch a command line such as:
"
java home path\bin\javaw.exe" -jar "
kse install path\kse.jar"
[…]
The installer has a Select Java Runtime page where you specify the Java home directory (it does some auto-detect using JavaSoft registry values, JAVA_HOME
and JRE_HOME
environment variables, and it also searches the path). If you run a reinstall, it will rewrite the kse.ini
file.
For anyone that wants to use KSE on Windows without the installer, you could provide a sample kse.ini
file and a readme.txt
that says you need to manually add the Java directory to it.
This would seem to be a simple and clean solution that provides a simple way to run KSE on Windows without needing symlinks, complicated searching in the executable, etc.
Thoughts?
That would be more than adequate, though I’m surprised you didn’t do the JVM location in the launcher rather than the installer, if the ini
file is not present. Perhaps because the installer is Windows specific, but the launcher code is not?
But that said, anyone using the zip package likely has more than enough skill to be able to set the path manually.
I suppose this is one approach. My thought was that the work of finding the Java runtime feels more appropriate for install time rather than run time, and it’s not hard to reinstall (or just manually edit the kse.ini
file).
@Bill-Stewart I really appreciate your efforts to improve KSE and at a later point in time I will certainly take a look at your Inno Setup installer.
However, a few comments above I have posted a pre-release version of the new KSE launcher. This is going to be the solution for the launcher issue for the next KSE release. It is not complete yet, but the next KSE release is still pretty far away.
As I have said earlier, the installer is not the right place to search for JREs. Updating or switching Java runtimes after the installation is obviously not handled. And I certainly don’t want to reinstall all my Java applications just because I have switched to another JRE. So the code for locating the JRE should be in the launcher, not in the installer.
In addition to the new launcher there will be a second version of KSE for Windows coming with the next release that includes a custom Java runtime. Providing a self-contained version of KSE is probably the best solution and it might also help with some tickets describing issues that I just cannot reproduce.
Providing a self-contained version of KSE is probably the best solution…
Hmmm. I’m not so sure. When it comes to cryptography, I want it to use the version I have installed. I think I’d be concerned if my keystore manager is using crypto from JSE 15, released, say in 2018, and it was 2025 and JSE 22 is the latest. Seems like bundling a JVM is just adding maintenance overhead.
Still, your project, your call.
And I certainly don’t want to reinstall all my Java applications just because I have switched to another JRE. So the code for locating the JRE should be in the launcher, not in the installer.
This is a persuasive argument in favor of including this logic in the launcher rather than the installer; I agree with this assessment.
After thinking about this some more, it seems this problem would be nicely solved on Windows by using a DLL that can detect a Java installation using the aforementioned techniques and return information about it. I wrote a prototype that exports 4 functions:
-
IsJavaInstalled()
— returns non-zero if Java is detected, or 0 if not detected -
IsJava64Bit()
— returns non-zero if the detected Java is 64-bit, or zero if not 64-bit -
GetJavaHome()
— returns a unicode string in an output parameter containing the Java home directory location -
GetJavaVersion()
— returns a unicode string in an output parameter containing the version number embedded injava.exe
I am doing some more testing, but it seems to me that this functionality would be useful not just to the KSE project but for anyone writing Java programs to be run on Windows.
@Bill-Stewart Sounds like a good idea. What language did you use?
It’s written in Object Pascal (FPC) and I have both x86 and x64 DLL binaries. The x86 version can detect 64-bit Java installations because it knows how to read the 64-bit registry and file system when running on a 64-bit OS.
Updated to v0.3. Replaced IsJava64Bit()
function with a more generic IsBinary64Bit()
function. (Useful in case Java detection fails but you know the path and filename of java.exe
and want to know if it’s 32-bit or 64-bit.)
@Bill-Stewart I took a quick look at your JavaInfo project and like how well documented and easy to understand everything is. 👍
Not sure if this is a problem or not, but right now any Java installation that has a registry entry under «HKLM\SOFTWARE\JavaSoft» wins, no matter how old this Java version is.
For example, someone has an old Oracle Java 8 installation and then installs Azure Zulu 15, which creates a registry entry, but under «HKLM\SOFTWARE\Azul Systems\Zulu» and adds its «bin» directory to the system path. JavaInfo will then still only find Java 8, which is not what the user would expect.
Something similar happens when AdoptOpenJDK 11 or 15 is installed and the option to set JAVA_HOME is checked (but not the JavaSoft option). Most users would expect that JAVA_HOME takes precedence over anything else.
One could argue that the user simply has to uninstall old Java JREs/JDKs, but an existing workaround is obviously not enough, otherwise this ticket would not have 34 comments.
@kaikramer Excellent feedback! It seems that JAVA_HOME
/JRE_HOME
/JDK_HOME
should take precedence over the registry. This is sensible and I think you are right about that.
It seems we also need to add SOFTWARE\Azul Systems
to the registry search (I wasn’t aware of that JDK/JRE). Are there any other JDK/JRE I can add to the registry searching?
(Aside: Thanks to feedback from the Inno Setup developer, I am also going to change the license to LPGL so that others can use the DLL more freely.)
Thanks again for the feedback!
@Bill-Stewart launch4j searches the following registry locations:
«SOFTWARE\JavaSoft\Java Runtime Environment»,
«SOFTWARE\JavaSoft\Java Development Kit»,
«SOFTWARE\JavaSoft\JRE»,
«SOFTWARE\JavaSoft\JDK»,
«SOFTWARE\Azul Systems\Zulu»,
«SOFTWARE\Azul Systems\Zulu»,
«SOFTWARE\IBM\Java Runtime Environment»,
«SOFTWARE\IBM\Java Development Kit»,
Amazon Corretto by default creates a registry entry under «SOFTWARE\JavaSoft\JDK» and updates both JAVA_HOME and PATH, so nothing special to do here:
@kaikramer Outstanding, thanks! I agree that the environment variable (JAVA_HOME
, etc.) should take precedence over the registry data.
@kaikramer I have published v0.4 using LPGL license and the suggested changes. Thanks for the feedback! Of course let me know if you have any other suggestions.
JavaInfo.dll has been updated to v1.0.0. I noticed that AdoptOpenJDK also adds registry data so I added that to the list of registry locations it searches. Per previous suggestions the search order is the following:
JAVA_HOME
/JDK_HOME
/JRE_HOME
environment variables (in that order)- Directories in
Path
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft
in registryHKEY_LOCAL_MACHINE\SOFTWARE\IBM
in registryHKEY_LOCAL_MACHINE\SOFTWARE\AdoptOpenJDK
in registryHKEY_LOCAL_MACHINE\SOFTWARE\Azul Systems\Zulu
in registry
Thanks for the feedback!
@Bill-Stewart It makes sense that the environment variables have precedence over the registry entries, because the user can check/change them pretty easily. But IMHO all registry locations should be searched equally for the newest Java version.
3. `HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft` in registry 4. `HKEY_LOCAL_MACHINE\SOFTWARE\IBM` in registry 5. `HKEY_LOCAL_MACHINE\SOFTWARE\AdoptOpenJDK` in registry 6. `HKEY_LOCAL_MACHINE\SOFTWARE\Azul Systems\Zulu` in registry
I would do these registry entries in 5,6,3,4 order. The JavaSoft and IBM entries are likely to be detritus from old installations, whereas AdoptOpenJDK and Azul, if they exist, are much more likely to be the current install.
Otherwise, I completely agree with this search order.
@lawrence-dol Thanks for the feedback! I am updating the DLL such that it returns the latest version across all registry subkey searches (as @kaikramer suggested — and I agree) so the specific order shouldn’t matter. We definitely need to search the JavaSoft
subkey because it gets used by:
- AdoptOpenJDK if
JavaSoft (Oracle) registry keys
component selected at install (it is not selected by default) - Amazon Corretto if
Setup Registry Keys
component selected at install (it is selected by default) - Azul Zulu
- Oracle Java
Also FYI: From my testing the Azul Systems\Zulu
subkey should actually not ever get searched if the Zulu install completes successfully because Zulu adds itself to JavaSoft
as noted above. (I added mainly for completeness.)
Released version 1.1.0 of the DLL. The search order is the following:
-
if
JAVA_HOME
/JDK_HOME
/JRE_HOME
environment variables (in that order) are defined, use as Java home directory. -
If environment variables above are not defined, search the directories named in the
Path
forjava.exe
. -
If the environment variables are not defined and
java.exe
is not in the path, then search the following registry subkeys for Java installations:HKEY_LOCAL_MACHINE\SOFTWARE\AdoptOpenJDK
HKEY_LOCAL_MACHINE\SOFTWARE\Azul Systems\Zulu
HKEY_LOCAL_MACHINE\SOFTWARE\IBM
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft
The registry search uses whichever of the above subkeys contains the Java home directory for the latest version of Java.
The Java version returned by the GetJavaVersion()
DLL function is the file version of javahome\bin\java.exe
(where javahome is the Java home directory).
Thanks for all the feedback!
As the launch4j project seems to be pretty dead (no release for more than two years), I have replaced launch4j with my own Windows launcher that uses the JAVA_HOME environment variable.
…
The next release of KSE will include this new launcher.
This comment about the new launcher is from November 2020. The most current release is 5.4.4, built on Oct 4, 2020.
So with the most current release I just ran into this problem (requires JRE 1.8). I replaced the original kse.exe
with the one from the ZIP and it works like a charm.
Would it be a big deal to build a version 5.4.5 with the new launcher?
Why I run into the problem:
I use Scoop to install almost everything I need on an almost «blank» windows machine without admin permissions. Therefore I don’t have any registry entries about Java and I never see or use the KSE installer. KSE and Java(s) are just dropped on the disk and JAVA_HOME/PATH vars are set.
It looks like @kaikramer has updated the Windows launcher executable to use JavaInfo.dll for the next version. JavaInfo.dll uses a variety of techniques to detect Java on Windows.
@sburkard The new launcher is not ready for a public release yet. Also, the next feature release of KSE (v5.5.0) is not that far away anymore.
I think the value of a kse.ini
, as Bill suggested, is being overlooked here. If this file exists, kse.exe
should treat it as the first stop in the Java runtime hunt, with a fallback to other techniques listed in the thread. I don’t like the idea of a bundled, self-contained, custom Java runtime.
Please note that AdoptOpenJDK is moving to adoptium.net and new MSI installers use the Eclipse Foundation
registry subkey (rather than AdoptOpenJDK
) — JavaInfo.dll has been updated to 1.3.0 to accommodate this change. Please test with latest Windows kse.exe launcher.
Closing tickets in preparation for release of KSE 5.5.0
After freemin is installed, the runtime prompts “this application requirements Java runtime environment 1.5”. It can be seen that the reason is that JDK is not installed in the local system or the environment information of JDK does not exist in the registry
The JDK installed in my local system is an installation free version, that is, after decompressing the compressed package, the configuration of relevant environment variables is finished, so there must be no information about JDK in the window registry. We need to manually add the relevant configuration information of JDK
Start – run the regedit command to enter the registry, and then find the following path [HKEY]_ LOCAL_ MACHINE\SOFTWARE\Wow6432Node\JavaSoft】
If you do not find the corresponding javasoft project, you need to create it manually, as shown in the following structure: