Why ElasticSearch as a Windows service requires JAVA_HOME to be set? - java

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?

Related

Java jdk11 installation on Windows 10 problems

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.

How to install JDK and JRE

I am attempting to run an application (monitor.exe) for monitoring things going on with my device when running a test program, but I am getting the following error message:
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Monitor. No Java virtual machine was found after searching the following locations:
C:\Users\Datu1\AppData\Local\ANdroid\Sdk\tools\lib\monitor-x86_64\jre\bin\javaw.exe
javaw.exe in your current PATH
Can I install via Android Studio or should I go to the Oracle website? Is it a single installation package for both the JRE and JDK? Also I have tried running command line commands to see if the JDK is installed as well as searching folders and it is not installed.
As #davedwards has said above, you would need to download and install the JRE from the Oracle website. If you still run into problems once installed or you have already installed the JRE you may need to check your PATH system variable.
The help section on the Oracle website Here
Will take you through this process.

How to install ElasticSearch without setting JAVA_HOME globally

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?

running neo4j in a machine with java 1.6

I am trying to run neo4j for the first time.
In my RHEL 6 machine, I have Java 1.6 installed. I do not want to change that because other programs are using that. When I tried to run neo4j, downloaded from here, I got the error: ERROR! Neo4j cannot be started using java version 1.6.0_24. Please use Oracle(R) Java(TM) 7. Clearly, I need to install JAVA 7. I was wondering if I can just download Java 7 and let neo4j know the path to java executables.
Set the JAVA_HOME and PATH before starting the neo4j server.
set the path on the terminal.
export JAVA_HOME=/home/jdk/jdk1.7.0_45
export PATH=$JAVA_HOME/bin:$PATH
then start the neo4j or you can create a bash script to do this automatically.
The different major versions are normally different packages (e.g., java-1.7.0-openjdk-devel) that go in different directories (usually in /opt), and you can set the JAVA_HOME and/or JDK_HOME environment variables in your startup script. That said, there's rarely any harm in running your programs on the version 7 JVM (just like you can upgrade the kernel without touching your installed programs), and Java 6 is EOL and won't get new security updates.
neo4j 2.0.2 uses java7 it seems and hence requires jdk7.
Go to neo4j website and download 1.8.3 version
http://dist.neo4j.org/neo4j-community-1.8.3-unix.tar.gz
and if you have java 1.6.45 in ubuntu, you are done
untar and copy to /opt and issue the below command from neo4j root directory
sudo ./bin/neo4j start

Running Jive Dev Enrivonment on Windows 7 64-bit

I've followed the following instructions to get Jive up and running on a windows 7 64 bit machine.
Java
Install latest version of Java
Download Java SE 6 Update 37 JDK (includes JRE) but do not install yet
Open a new command prompt and run java --version to verify that it is correctly installed.
If you receive an error saying version 1.5 was expected and 1.7 was found, make sure all versions of software are for the correct OS (64 or 32 bit) which may require you to uninstall current versions (system will use the most recent version installed, even if you try to install an older version after the newer version was installed)
Eclipse
Download & install Eclipse IDE for Java EE Developers
Once installed, create your default workspace and access Help – Eclipse Marketplace
Search the marketplace for SubClipse and install
Search the marketplace for Maven Integration for Eclipse WTP and install
PostGres
Install postgreSQL
Once you have installed postgres, uninstall java from the C:\oracle\Ora11gR2\product\11.2.0\client_1 directory and install Java version 7 there.
Open pgAdmin, click on the “plug” to create a new connection
Set name and host to localhost and include your network usename, port number, and password used when installing postgres
Expand the database tree, right click to add new login role - configure new login role as super user by selecting all options under role privileges, set PW under definition tab, and hit ok
exit or disconnect and log back in as your user
Create desired databases
Maven
Install binary mirror download of maven
Unzip the distribution archive, i.e. apache-maven-3.0.4-bin.zip to the directory you wish to install Maven 3.0.4. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.0.4 will be created from the archive.
Unzip the distribution archive, i.e. apache-maven-3.0.4-bin.zip to the directory you wish to install Maven 3.0.4. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.0.4 will be created from the archive.
Go to your environment variable (How to) dialog within Control Panel\System and Security\System and access Advanced system settings. On the System properties dialog, go to the Advanced tab and click “Environment Variables”
Add the M2_HOME variable in the system variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.0.4
add the M2 environment variable in the system variables with the value %M2_HOME%\bin
add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m
update/create the Path environment variable in the system variables and append the value %M2% to add Maven available in the command line. (add ;%M2% to the end of the path value)
Add/Update JAVA_HOME in your system variables and set the value to the location of your JDK, e.g. C:\Program Files\Java\jdk1.5.0_02
Make sure that %JAVA_HOME%\bin is in your Path environment variable. If not, append to existing Path system variable (remember to separate by semi-colon)
Open a new command prompt and run mvn --version to verify that it is correctly installed.
If this fails investigate the issues discussed in this article.
In the user’s directory (ie \USERNAME.m2) there will be a .m2 directory for the Maven repository. Create a settings.xml file in that directory with the repository settings
Jive Build
Check Jive out of SVN repository
edit the pom.xml file in the project root. Make sure the jive short version at about line 20 is set correctly: 5.0.2.1
Open a terminal window. Change to the top level project directory
Run this: mvn clean install -Djive.setup=false -P external
This is where i get stuck - I get a cmd prompt error when i run mvn clean install -Djive.setup=false -X external to get the debug log, and it says it's still missing the repository.
I've seen some documentation saying to get this all working on a windows 7 machien you should use a VM, but i've also seen that it's possible to do, just not supported.
Has anybody successfully installed, built, and ran jive on windows 7?
Following https://community.jivesoftware.com/docs/DOC-3547 for setting up maven says:
Note: this Maven configuration provides access to Jive binaries and sources via the maven-secure.jivesoftware.com server; it requires login access. See the bottom of the document where to put your login information.
Please request maven access by creating a Supportal case. If you do not have a company group, you may email your maven request to accountsupport#jivesoftware.com
It's possible that you don't have the required access.
the tricky part is getting the eae engine up and running in windows 7. It works from Jive 6 onwards. I remember in Jive 5 running the eae engine in a linux vm and hooking into it. after the setup, unless your doing development that requries the eae engine then you can just shut it off...

Categories

Resources