Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Elasticsearch 5.0.2 on Windows 8 - \config\jvm.options "was unexpected at this time"

I'm new to Stack Overflow (though a long time lurker). I'm struggling to install elasticsearch on my laptop. It's windows 8, I've just updated java to Java 8 and I've set the new path using set JAVA_HOME.

However, whenever I try to run the elasticsearch.bat file on the command line, I get this error:

\elasticsearch-5.0.2\bin\..\config\jvm.options was unexpected at this time

Any help would be greatly appreciated on this matter

like image 265
Mimikyu Avatar asked Dec 05 '16 11:12

Mimikyu


2 Answers

Your problem is most likely caused by parentheses in the path to where you unzipped and are running Elasticsearch from. The related issue in the Elasticsearch repository is #24712 which will be fixed with Elasticsearch 5.4.1.

Be aware that by applying Nicholas Lie's "fix" you are telling Elasticsearch to effectively ignore all settings in config/jvm.options. While this may help you to start Elasticsearch in this specific case, it will only start with default JVM options which might lead to surprising behavior down the road.

like image 36
Daniel Mitterdorfer Avatar answered Nov 07 '22 15:11

Daniel Mitterdorfer


I've also tried to setup the ElasticSearch on my Windows 2016 R2 Datacenter (64-bit). Let me share some of my experiences on how to solve this.


Setting up JAVA_HOME

Ensure that you have JDK/JRE installed. You can download it here.

Set the JAVA_HOME environment variable. To do this, open the Start menu and type in "path".

environment_variable

Then click on Environment Variables. If you don't have JAVA_HOME variable set yet, click New.

java_home

The JAVA_HOME variable should only lead up to the JDK/JRE directory, not including /bin.

C:\Progra~1\Java\jdk1.8.0_112

Progra~1 corresponds to Program Files. If you use Program Files (x86), change Progra~1 to Progra~2

Restart your computer. Once your computer is restarted, open up CMD and type in echo %JAVA_HOME%. The output should be

C:\Progra~1\Java\jdk1.8.0_112

If you get the following output, your JAVA_HOME is setup correctly.


Running ElasticSearch

The first time I tried to run ElasticSearch, I get the following output.

enter image description here

The odd directory I pointed out here gave me a hint that the batch file might be reading from the wrong directory. So what I did was tinker around with the batch file a bit. Open elasticsearch.bat using any text editor.

Scroll all the way to the end, somewhere above the last lines you'll see something similar to the following.

wrong path

Remove the highlighted line, save the file and try running the batch file again via command prompt.

It works in my case.

run

Once you have this, open up your browser and navigate to localhost:9200.

localhost

I think that's it?

like image 144
Nicholas Lie Avatar answered Nov 07 '22 15:11

Nicholas Lie