Homebrew-core: jmeter formula doesn't support Java 9

Created on 27 Oct 2017  路  12Comments  路  Source: Homebrew/homebrew-core

  • [x] Confirmed this is a problem with brew installing one, specific Homebrew/homebrew-core formula (not cask or tap) and not every time you run brew? If it's a general brew problem please file this issue at https://github.com/Homebrew/brew/issues/new. If it's a brew cask problem please file this issue at https://github.com/caskroom/homebrew-cask/issues/new. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • [x] Ran brew update and retried your prior step?
  • [x] Ran brew doctor, fixed all issues and retried your prior step?
  • [x] Ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link? https://gist.github.com/d880b0aeb9d83be2f2a98540421a9434
  • [x] If brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

After installing jmeter, it fails to start:

$ jmeter
Error: Java version is too low to run JMeter. Needs at least Java >= 1.8.0

This because of this bit of shell script in /usr/local/Cellar/jmeter/3.3/libexec/bin/jmeter:

# Minimal version to run JMeter
MINIMAL_VERSION=1.8.0

# Check if Java is present and the minimal version requirement
_java=`type java | awk '{ print $ NF }'`
CURRENT_VERSION=`"$_java" -version 2>&1 | awk -F'"' '/version/ {print $2}'`
minimal_version=`echo $MINIMAL_VERSION | awk -F'.' '{ print $2 }'`
current_version=`echo $CURRENT_VERSION | awk -F'.' '{ print $2 }'`
if [ $current_version ]; then
        if [ $current_version -lt $minimal_version ]; then
                 echo "Error: Java version is too low to run JMeter. Needs at least Java >= ${MINIMAL_VERSION}." 
                 exit 1
        fi
    else
         echo "Not able to find Java executable or version. Please check your Java installation."
         exit 1
fi

which compares the 8 in 1.8.0 to the 0 in 9.0.1 (the java cask), thus deciding Java 9 is too old.

This is a known issue.

java upstream issue

Most helpful comment

@nemtech13
Same in the jmeter.sh file on mac os. Just remove/comment the java version check section.

_java=`type java | awk '{ print $ NF }'`
CURRENT_VERSION=`"$_java" -version 2>&1 | awk -F'"' '/version/ {print $2}'`
minimal_version=`echo $MINIMAL_VERSION | awk -F'.' '{ print $2 }'`
current_version=`echo $CURRENT_VERSION | awk -F'.' '{ print $2 }'`
if [ $current_version ]; then
        if [ $current_version -lt $minimal_version ]; then
                 echo "Error: Java version is too low to run JMeter. Needs at least Java >= ${MINIMAL_VERSION}." 
                 exit 1
        fi
    else
         echo "Not able to find Java executable or version. Please check your Java installation."
         exit 1
fi

All 12 comments

Please file an issue upstream.

Thanks @romanlevin!

@ilovezfs given that jmeter doesn't support Java 9 at the moment, and 9 is the default Cask version, maybe there should be a caveat mentioning that in this formula?

@romanlevin no it needs a wrapper script and depends_on :java => "1.8" just like everything else on the planet that Java 9 broke.

Oh okay. Not really clued in to this transition so wasn't aware it was a much larger issue.

@romanlevin yeah it's a bit of a mess https://github.com/Homebrew/homebrew-core/issues/19696

I removed/commented out the lines below in jmeter.bat to by pass this check since it is looking at the '0' in version 9. It works for me.

if %current_minor% LSS %minimal_minor% (
@echo Error: Java version -- %JAVAVER% -- is too low to run JMeter. Needs a Java version greater than or equal to %MINIMAL_VERSION%
set ERRORLEVEL=3
goto pause
)

@nemtech13
Same in the jmeter.sh file on mac os. Just remove/comment the java version check section.

_java=`type java | awk '{ print $ NF }'`
CURRENT_VERSION=`"$_java" -version 2>&1 | awk -F'"' '/version/ {print $2}'`
minimal_version=`echo $MINIMAL_VERSION | awk -F'.' '{ print $2 }'`
current_version=`echo $CURRENT_VERSION | awk -F'.' '{ print $2 }'`
if [ $current_version ]; then
        if [ $current_version -lt $minimal_version ]; then
                 echo "Error: Java version is too low to run JMeter. Needs at least Java >= ${MINIMAL_VERSION}." 
                 exit 1
        fi
    else
         echo "Not able to find Java executable or version. Please check your Java installation."
         exit 1
fi

This is now fixed if you brew update and brew upgrade

For run jmeter 3.3 with Java 10 I used this temporal solution.

_java=type java | awk '{ print $ NF }'
CURRENT_VERSION="$_java" -version 2>&1 | awk -F'"' '/version/ {print $2}'
minimal_version=echo $MINIMAL_VERSION | awk -F'.' '{ print $1 }'
current_version=echo $CURRENT_VERSION | awk -F'.' '{ print $1 }'

Was this page helpful?
0 / 5 - 0 ratings