So I'm installing CMAK(Cluster Manager for Apache Kafka) and when I run rẩy 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 lớn 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 u, please!

OneCricketeer

191k20 gold badges141 silver badges266 bronze badges

asked May 2, 2023 at 0:49

It appears that you are running with Java 19 rather kêu ca 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 cấm trẻ em the Java runtime is not just giving a deprecation warning. The SecurityManager class has now been changed lớn 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:

  • Downgrade lớn Java 17 (or maybe Java 11 or Java 8)
  • Upgrade lớn SBT 1.9.0-RC1 or later ... where SBT's dependency on 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 lớn tư vấn them immediately (if at all), or for any length of time. For example the SBT documentation recommends Java 8, 11 or 17.

answered May 2, 2023 at 1:11

6