I'm trying to install ElasticSearch on my machine. The goal is to install everything without setting JAVA_HOME as it may interfere with other software
I downloaded the latest JRE and installed it. At this stage JAVA_HOME is not set and that's exactly what I was expecting
Then, I ran the following:
elasticsearch-service.bat install elasticsearch-service
"C:\path_to_my_jre"
First problem: if the path to my JRE contains whitespaces the command will fail. If I place the JRE on a path without whitespaces it works fine.
After some struggling the ElasticSearch service is now installed correctly
Unfortunately if I try to run the service (from the Windows services panel) it doesn't start, the log file states that JAVA_HOME is not set.
It is possible to avoid setting JAVA_HOME globally? Setting it would mean interfering with other applications and I don't want to take that risk
I noticed that the Windows service being created calls the elasticsearc-service-x64.exe passing it a weird parameter \RS.... . What's that parameter? Can I pass a custom JRE path to that executable and avoid setting JAVA_HOME alltogether?
Related
I had on my Windows 10 (Vmachine in Citrix) Java JRE 17 preinstalled.
By calling it in the command prompt with java --version, I got the response of the version that was installed.
Since I needed to install JDK 11 on my machine, I proceeded to the installation from Oracle and installed the JDK8 exe file and executed it. The installation was successful. So I had JRE17 and JDK11.
I have changed the environment variable (System Variables) that was set for JAVA_HOME from the path of JRE17, to my new destination path of JDK11.
I have changed the Path variable that was set for JRE17 to JDK11 as well.
Clicked OK and again OK on the System properties window to save the changes I made.
Reopened the command prompt. After then calling the prompt command with java --version, I got the response, that is not recognized as an internal or external command (my JDK11).
Now, after I tried to set back the environment variable of JAVA_HOME and the Path to JRE17, I again get the response that is not recognized as an internal or external command (my JRE17 that was working just before the change. I was taking good care, not to make a mistake while changing and setting the environment variables and even tried with resetting my machine in hope it would work afterwards.
So what I actually need later on, is Apache Maven 3.8.5. For that installation, I needed to make sure, JAVA_HOME is set to the location of my JDK, which was the reason why I was installing JDK11 (as instructed).
Could anyone assist me with this matter and give me some instructions on what am I doing wrong? I spent already 12 hours of installing, deinstalling, reinstalling, resetting paths and it seems that I am missing something.
I have built my cordova app and getting "Requirements check failed for JDK 1.8" error message.
Uninstalling all java and installing jdk 1.8 not solved my problem.
D:\xampp\htdocs\aware>cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\Baha\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_221
Requirements check failed for JDK 1.8
ScreenShots:
You might have installed more than one Java (binaries) on your system. First of all, check this, by executing where java command in your cmd.exe (command line).
Most likely, you will see more than one java.exe installed, and if so, this may be the reason, despite installing new Java, your system still provides one more other version of it;
Even if you have set your %JAVA_HOME% environment variable accordingly, there might be another java.exe available in your environment, either because of having some other Java binaries' bin folder added in the System variables' (under Environment Variables) Path variable, or because of having it at some other place, which is also available through any other environment variable (for instance: System32 on Windows).
Check where java and see your Path environment variable under the System Variables.
My problem solved partially, I have changed the path and try to build with vs code, it works, but phpstorm still not build my app.
In Windows environments, is there a way to indicate ElasticSearch (installed as a service) the Java location to be used without using the JAVA_HOME environment variable?
In order to deliver ElasticSearch to our customers we would like to deliver it with a private JRE 8, so we need to point to that specific version. The easiest way is to use the JAVA_HOME environment variable. However, we would like to avoid interfering with other applications that may use that variable.
I've solved my own issue by using a ZIP version of Elasticsearch (instead of the *.msi). The idea is to set the JAVA_HOME to the private JRE/JDK in the same installing CMD process and then call:
\bin\elasticsearch-service.bat install
\bin\elasticserach-service.bat start
Previously, the elasticsearch-service.bat must be modified to add the option --Jvm "%JAVA_HOME%%JVM_DLL%" instead of --Jvm "%%JAVA_HOME%%%JVM_DLL%"
I'm developing a software which uses ElasticSearch. ElasticSearch is based on Java so I need Java JRE 1.8 to be installed on the user PC as part of the installation process. Java 1.8 JRE may or may not be present on the user PC.
I'm trying to understand how to properly install ElasticSearch on the user PC.
I tried installing Java JRE 1.8 on a clean Windows 7 virtual machine. After the installation process, the environmental variable PATH get updated with the path to the java.exe executable. This allows to call java.exe from anywhere in the console
ElasticSearch runs just fine when I launch the elasticsearch.bat script, I launch this:
elasticsearch.bat
I get this (which is fine, ElasticSearch runs correctly):
However, if I try to install the ElasticSearch service:
elasticsearch-service.bat install
I need to set the JAVA_HOME environment variable beforehand. I can set it on a local scope like this
SET JAVA_HOME=mypath
elasticsearch-service.bat install
This way the script successfully installs the Windows Service. However, if I try to run the service I get an error stating that JAVA_HOME is not set on the system. Looking at the log files I get this error:
My question is, why ElasticSearch as a Windows service requires JAVA_HOME to be set? My reasoning is: java.exe is available system wide (by means of PATH) why the Windows service requires JAVA_HOME?
I am trying to change between Java7 and Java 8 environments. I created the following new environment variables:
JAVA7_HOME - java 7 location
JAVA8_HOME - java 8 location
JAVA_HOME
I then set JAVA_HOME to be %JAVA8_HOME% or %JAVA7_HOME%. In path I have
%JAVA_HOME%\bin;REST OF PATH
It seems no matter what I set JAVA_HOME to it will not change the outcome of java -version, even for new sessions.
How can we have two separate java environments while easily changing between them? I've tried setting everything to the correct paths, that includes:
HKEY_CURRENT_USER\Environment JAVA_HOME
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment CurrentVersion
and even changing symlinks to point to the version we want. We've create batch scripts to do it all, we've create powershell/,net to do it and then broadcast, tried setting it all and restarting explorer.. It seems impossible to switch between 7 and 8.
Does anyone have an idea how to resolve this?
The basic problem is that changing environment variables via commandline is not permanent for some reason. You'll have to set the new value via the UI.
I used to do the following:
Put both the jdk8 and the jdk7 in your path (put the one you want as "default" first).
Look up java.exe and javac.exe in the jdk8 bin/ directory. Copy the executables under the name java8.exe and javac8.exe.
Do the same in the jdk7 bin/ directory, and copy the binaries to java7.exe and javac7.exe.
Now you can call java/javac, java7/javac7 and java8/javac8.
(I am not sure why anybody would need JAVA_HOME, I never set it.)
The other excutables like jar.exe and so on will be taken from the default jdk (the one first in the path), this is ok, since your JAR files will be the same no matter which jar.exe made them.
Then go on to configure the applications you need, like eclipse.
Hopefully, also your build tool can be told which executables to use. If not, it will use the default.
This way, you can also realize crazy configurations. For example, suppose you want jdk7 as default, but want to always use the java8 javadoc. Then simply rename the javadoc.exe from jdk7, for example to javadoc-dontuse.exe. This way, when you type javadoc.exe or some application calls it, it will not find it in the (default) jdk7 and continue to search in the jdk8 bin.