[
https://issues.apache.org/jira/browse/SOLR-6694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14195122#comment-14195122
]
Jan Høydahl commented on SOLR-6694:
-----------------------------------
Here's some code from a start script I created long ago:
{noformat}
echo "Detecting JAVA_HOME"
if "%JAVA_HOME%"=="" call:FIND_JAVA_HOME
echo "Java home: %JAVA_HOME%"
goto:DETECTED
:FIND_JAVA_HOME
FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java
Runtime Environment" /v CurrentVersion') DO set CurVer=%%B
FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java
Runtime Environment\%CurVer%" /v JavaHome') DO set JAVA_HOME=%%B
goto:EOF
:DETECTED
echo "Do whatever"
{noformat}
> Auto detect JAVA_HOME in bin\start.cmd
> --------------------------------------
>
> Key: SOLR-6694
> URL: https://issues.apache.org/jira/browse/SOLR-6694
> Project: Solr
> Issue Type: Improvement
> Components: scripts and tools
> Affects Versions: 4.10.2
> Environment: Windows
> Reporter: Jan Høydahl
>
> The start script requires JAVA_HOME to be set.
> The Java installer on Windows does not set JAVA_HOME, so it is an obstacle
> for new users who wants to test. What the installer does is to set some
> registry values, and we can detect those to find a JAVA_HOME to use. It will
> give a better user experience.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]