关于jvm系统属性-Djava.awt.headless 模式(idea设置、代码配置)

  1. 什么是 java.awt.headless?
    Headless模式是系统的一种配置模式。在系统可能缺少显示设备、键盘或鼠标这些外设的情况下可以使用该模式。

  2. 何时使用和headless mode?
    Headless模式虽然不是我们愿意见到的,但事实上我们却常常需要在该模式下工作,尤其是服务器端程序开发者。因为服务器(如提供Web服务的主机)往往可能缺少前述设备,但又需要使用他们提供的功能,生成相应的数据,以提供给客户端(如浏览器所在的配有相关的显示设备、键盘和鼠标的主机)。

  3. 如何使用和Headless mode?
    一般是在程序开始激活headless模式,告诉程序,现在你要工作在Headless mode下,就不要指望硬件帮忙了,你得自力更生,依靠系统的计算能力模拟出这些特性来:


```java
 System.setProperty("java.awt.headless", "false");```

在这里插入图片描述

构建进程终止异常: C:\Users\阿榆\.jdks\openjdk-22.0.2\bin\java.exe -Xmx700m -Djava.awt.headless=true "-Djna.boot.library.path=D:\java\IntelliJ IDEA 2024.1.4/lib/jna/amd64" -Djna.nosys=true -Djna.noclasspath=true --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED "-Dpreload.project.path=D:/java/Java 学习/Java SE" -Dpreload.config.path=C:/Users/阿榆/AppData/Roaming/JetBrains/IntelliJIdea2024.1/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Didea.IntToIntBtree.page.size=32768 -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=-1040225010816134979 -Dfile.encoding=GBK -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2024.1 -Djps.language.bundle=C:/Users/阿榆/AppData/Roaming/JetBrains/IntelliJIdea2024.1/plugins/zh.241.271/lib/zh.241.271.jar "-Didea.home.path=D:/java/IntelliJ IDEA 2024.1.4" -Didea.config.path=C:/Users/阿榆/AppData/Roaming/JetBrains/IntelliJIdea2024.1 -Didea.plugins.path=C:/Users/阿榆/AppData/Roaming/JetBrains/IntelliJIdea2024.1/plugins -Djps.log.dir=C:/Users/阿榆/AppData/Local/JetBrains/IntelliJIdea2024.1/log/build-log "-Djps.fallback.jdk.home=D:/java/IntelliJ IDEA 2024.1.4/jbr" -Djps.fallback.jdk.version=17.0.11 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=C:/Users/阿榆/AppData/Local/JetBrains/IntelliJIdea2024.1/compile-server/java_se_f741f0a1/_temp_ -Dj
03-20
C:\Users\27052\.jdks\openjdk-22.0.1\bin\java.exe -Xmx700m -Djava.awt.headless=true "-Djna.boot.library.path=E:\IntelliJ IDEA Community Edition 2024.1/lib/jna/amd64" -Djna.nosys=true -Djna.noclasspath=true --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dexternal.project.config=C:\Users\27052\AppData\Local\JetBrains\IdeaIC2024.1\projects\项目源码.c3341a32\external_build_system -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Didea.IntToIntBtree.page.size=32768 -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=-175468241574438128 -Dfile.encoding=GBK -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IdeaIC2024.1 -Djps.language.bundle=C:/Users/27052/AppData/Roaming/JetBrains/IdeaIC2024.1/plugins/zh.241.219/lib/zh.241.219.jar "-Didea.home.path=E:/IntelliJ IDEA Community Edition 2024.1" -Didea.config.path=C:/Users/27052/AppData/Roaming/JetBrains/IdeaIC2024.1 -Didea.plugins.path=C:/Users/27052/AppData/Roaming/JetBrains/IdeaIC2024.1/plugins -Djps.log.dir=C:/Users/27052/AppData/Local/JetBrains/IdeaIC2024.1/log/build-log "-Djps.fallback.jdk.home=E:/IntelliJ IDEA Community Edition 2024.1/jbr" -Djps.fallback.jdk.version=17.0.10 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=C:/Users/27052/AppData/Local/JetBrains/IdeaIC2024.1/compile-server/项目源码_5a7db58f/_temp_ -Djps.backward.r
最新发布
03-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值