So I'm installing CMAK(Cluster Manager for Apache Kafka) and when I run the command
sbt clean dist
in the terminal, i receive this error
java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
at java.base/java.lang.System.setSecurityManager(System.java:425)
at sbt.TrapExit$.installManager(TrapExit.scala:53)
at sbt.StandardMain$.runManaged(Main.scala:127)
at sbt.xMain$.run(Main.scala:67)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at sbt.internal.XMainConfiguration.run(XMainConfiguration.scala:45)
at sbt.xMain.run(Main.scala:39)
at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
at xsbt.boot.Launch$.run(Launch.scala:149)
at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
at xsbt.boot.Launch$.launch(Launch.scala:159)
at xsbt.boot.Launch$.apply(Launch.scala:44)
at xsbt.boot.Launch$.apply(Launch.scala:21)
at xsbt.boot.Boot$.runImpl(Boot.scala:78)
at xsbt.boot.Boot$.run(Boot.scala:73)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
So I have been trying to fix this all morning, and still not understanding what is really going on here. My current version of dependencies:
JDK: 19
JRE: 1.8.0_202
SBT: 1.8.2
Help me, please!
It appears that you are running with Java 19 rather than the Java 8 JRE. (You would not get this error for Java 8.)
The deprecation warning for SecurityManager in SBT has been raised as an SBT issue; see https://github.com/sbt/sbt/issues/6558. But that is against Java 17.
In Java 18+ the Java runtime is not just giving a deprecation warning. The SecurityManager class has now been changed to be non-functional; see https://openjdk.org/jeps/411 ... where it talks about the plans for Java 18 and later.
As a result, SBT 1.8.2 and earlier don't work on Java 18 and later.
Your options are:
SecurityManager is apparently removed. (The issue above has been closed as Resolved.)As a general rule, I would recommend people stick with the LTS Java releases; i.e. 8, 11 and 17 (and 21 when it arrives). The non-LTS releases are EOL'd after 6 months, and 3rd-party software vendors tend not to support them immediately (if at all), or for any length of time. For example the SBT documentation recommends Java 8, 11 or 17.
Rerunning the command with this option -Djava.security.manager=allow for JRE 17+ worked for me. Like sbt -Djava.security.manager=allow clean dist
Got this from the issue reported on the github sbt repo https://github.com/sbt/sbt/issues/6558#issuecomment-1457274792
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With