When I run the following part in a bash script it works:
/usr/bin/java \
-Dspring.index.ignore=true \
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED \
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \
--illegal-access=permit \
-jar /home/x/my.jar \
--spring.config.additional-location=/home/x/config.yml
However if I modify it slightly to use it as a part of a systemd-service:
ExecStart=/usr/bin/java \
-Dspring.index.ignore=true \
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED \
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \
--illegal-access=permit \
-jar /home/x/my.jar \
--spring.config.additional-location=/home/x/config.yml
It shows me:
● my.service - my
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Unknown lvalue '--illegal-access' in section 'Service'
Missing '='.
Ignoring unknown escape sequences: ""
Unknown lvalue '--add-exports' in section 'Service'
Unknown lvalue '--add-exports' in section 'Service'
Unknown lvalue '--add-exports' in section 'Service'
Unknown lvalue '--add-exports' in section 'Service'
Unknown lvalue '--add-exports' in section 'Service'
Unknown lvalue '--illegal-access' in section 'Service'
Missing '='.
What is the right syntax for this? I was so sure that simple bash should work here.
P.S. Just noticed if I place everything in one line, it works. However it would be great to know how to keep everything on multiple lines.
java -jar
command,my.sh
for example and thenExecStart=/home/x/my.sh
– Krackout Aug 12 '20 at 13:56