【问题标题】:Java option doesn't work with java tool option in java 17Java option doesn\'t work with java tool option in java 17
【发布时间】:2022-12-02 04:23:18
【问题描述】:

I used below command to activate jmx and also needed javaagent in my program and it worked fine in java 11. the command is as below:

java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8071  
-javaagent:D:\resources\aspectjweaver-1.9.7.jar -jar app.jar

but when i upgraded java to java 17 program exit unexpectedly without any exception. does java 17 need any circumstances in order to use java options with java tool options?

any help would be appreciated.

I define JAVA_TOOL_OPTIONS environment variable but my problem doesn't fix.

【问题讨论】:

  • I would suspect that aspectj 1.9.7 is not yetreadyto handle Java 17 code || reading the release notes for 1.9.7 we find: "AspectJ 1.9.7 supports Java 15 & Java 16" (I assume that also applies to the agent)

标签: java jvm aspectj java-17


【解决方案1】:

You can use AspectJ Weaver 1.9.7 on Java 17+ if and only if the bytecode you want to weave only consists of classes compiled to targets <= Java 16. Otherwise, please upgrade to a more recent AspectJ version, ideally the latest 1.9.9.1.

Please also note that in order to use LTW (load-time weaving) on Java 16+, you need to add --add-opens java.base/java.lang=ALL-UNNAMED to the Java command line, as described in the release notes. Even the 1.9.7 release notes contain that information.

【讨论】:

    猜你喜欢
    • 2022-12-27
    • 2022-12-28
    • 2022-12-27
    • 2022-12-02
    • 2022-12-27
    • 2016-11-08
    • 2022-12-28
    • 2011-10-01
    • 1970-01-01
    相关资源
    最近更新 更多