[ 
https://issues.apache.org/jira/browse/SOLR-6693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14230544#comment-14230544
 ] 

Timothy Potter commented on SOLR-6693:
--------------------------------------

I've added Java version parsing to the script to determine if specific JVM 
flags should be enabled, but I think we can re-use this approach to solve this 
issue (with a little refactoring). I can do the work, but I don't have a 32-bit 
windows environment to test with.
{code}
@REM Add Java version specific flags if needed
set JAVAVER=
set JAVA_MAJOR=
set JAVA_BUILD=0

"%JAVA%" -version 2>&1 | findstr /i "version" > javavers
set /p JAVAVEROUT=<javavers
del javavers
for /f "tokens=3" %%g in ("!JAVAVEROUT!") do (
  set JAVAVER=%%g
  set JAVAVER=!JAVAVER:"=!
  for /f "delims=_ tokens=1-3" %%v in ("!JAVAVER!") do (
    set JAVA_MAJOR=!JAVAVER:~0,3!
    set /a JAVA_BUILD=%%w
  )
)
IF "!JAVA_MAJOR!"=="1.7" (
  set "GC_TUNE=%GC_TUNE% -XX:CMSFullGCsBeforeCompaction=1 
-XX:CMSTriggerPermRatio=80"
  IF !JAVA_BUILD! GEQ 40 (
    IF !JAVA_BUILD! LEQ 51 (
      set "GC_TUNE=!GC_TUNE! -XX:-UseSuperWord"
      @echo WARNING: Java version !JAVAVER! has known bugs with Lucene and 
requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.
    )
  )
)
{code}

> Start script for windows fails with 32bit JRE
> ---------------------------------------------
>
>                 Key: SOLR-6693
>                 URL: https://issues.apache.org/jira/browse/SOLR-6693
>             Project: Solr
>          Issue Type: Bug
>          Components: scripts and tools
>    Affects Versions: 4.10.2
>         Environment: WINDOWS 8.1
>            Reporter: Jan Høydahl
>            Assignee: Jan Høydahl
>              Labels: bin\solr.cmd
>             Fix For: 5.0, Trunk
>
>         Attachments: SOLR-6693.patch
>
>
> *Reproduce:*
> # Install JRE8 from www.java.com (typically {{C:\Program Files 
> (x86)\Java\jre1.8.0_25}})
> # Run the command {{bin\solr start -V}}
> The result is:
> {{\Java\jre1.8.0_25\bin\java was unexpected at this time.}}
> *Reason*
> This comes from bad quoting of the {{%SOLR%}} variable. I think it's because 
> of the parenthesis that it freaks out. I think the same would apply for a 
> 32-bit JDK because of the (x86) in the path, but I have not tested.
> Tip: You can remove the line {{@ECHO OFF}} at the top to see exactly which is 
> the offending line
> *Solution*
> Quoting the lines where %JAVA% is printed, e.g. instead of
> {noformat}
>   @echo Using Java: %JAVA%
> {noformat}
> then use
> {noformat}
>   @echo "Using Java: %JAVA%"
> {noformat}
> This is needed several places.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to