- 1 year ago
getting "\Java\jre1.8.0.351 was unexpected at this time" when trying to run elasticsearch.bat on Windows 10
If you are encountering the error message "\Java\jre1.8.0.351 was unexpected at this time" when trying to run Elasticsearch on Windows 10, there may be an issue with the environment variable settings.
Here are some steps you can try to resolve the issue:
Check the Java installation: Make sure that Java is installed correctly on your system and that the
JAVA_HOME
environment variable is set correctly. You can check the Java version and installation path by running the following commands in a command prompt:bashjava -version
echo %JAVA_HOME%
The
java -version
command should display the Java version installed on your system, and theecho %JAVA_HOME%
command should display the path to the Java installation directory.Check the Elasticsearch installation: Make sure that Elasticsearch is installed correctly on your system and that the
ES_HOME
environment variable is set correctly. You can check the Elasticsearch installation path by running the following command in a command prompt:bashecho %ES_HOME%
The
echo %ES_HOME%
command should display the path to the Elasticsearch installation directory.Check the Elasticsearch batch file: Make sure that the Elasticsearch batch file (
elasticsearch.bat
) is located in the correct directory and that there are no errors or typos in the file. Open the batch file in a text editor and check that the environment variables are being used correctly.Try using the full path to Java: Instead of using the
%JAVA_HOME%
environment variable, try using the full path to the Java executable in the Elasticsearch batch file. For example:arduinoset JAVA_HOME=C:\Program Files\Java\jre1.8.0_351
"%JAVA_HOME%\bin\java.exe" -version
Replace
C:\Program Files\Java\jre1.8.0_351
with the actual path to your Java installation directory.
If none of these solutions work, you may want to seek further assistance from the Elasticsearch or Windows community or support team.