Automator shell script application doesn’t work in 10.13

automator

I created application by automator for running jmeter. Since 10.13, this application does not work any more.

My shell script(I put jmeter directory in application Contents):

RADIR=`ps x | grep jmeter | grep -v grep | cut -c 28- `
COMMAND="$(dirname "$RADIR")/jmeter/bin/jmeter > /dev/null 2>&1 &"
eval $COMMAND

I checked that command is correct. But it doesn't work by running application. And it worked well before 10.12

I got some messages in Console log, The reason seems to be security exception. I am not sure
enter image description here

Some security mechanisms have been changed? How can fix it?

Thanks

Best Answer

About my previous analysis, I was totally wrong.

I ignore an important thing, Java version, not mac os x version. I just installed jdk 10 additionally and I also have jdk 8 in my system. Of course I set environment variable JAVA_HOME for jdk 8 in .bash_profile and .bashrc files, I checked java version in Terminal, it's java 8, everything is fine.

But in automator running process, java version is 10

Change shell script for getting error message

RADIR=`ps x | grep jmeter | grep -v grep | cut -c 28- `
java -version > ~/log.jmeter 2>&1 &
COMMAND="$(dirname "$RADIR")/jmeter/bin/jmeter >> ~/log.jmeter 2>&1 &"
eval $COMMAND

log.jmeter:

java version "10.0.1" 2018-04-17

Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)

Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

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

What!!!! That's the problem~~~

Change shell script to fix it:

export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
export PATH=$PATH:$JAVA_HOME/bin
RADIR=`ps x | grep jmeter | grep -v grep | cut -c 28- `
COMMAND="$(dirname "$RADIR")/jmeter/bin/jmeter > /dev/null 2>&1 &"
eval $COMMAND

It works well.

So, there are two problems in this issue:

  1. Jmeter is not support jdk 10 (wait for official update)
  2. How to properly set java home environment variable for automator?