[SOLVED] Caused by: java.awt.HeadlessException when trying to create a SWING/AWT frame from Sprin...

简介: [SOLVED] Caused by: java.awt.HeadlessException when trying to create a SWING/AWT frame from Spring BootIn Spring Boot, when y...

[SOLVED] Caused by: java.awt.HeadlessException when trying to create a SWING/AWT frame from Spring Boot

In Spring Boot, when you try to create a Swing frame from the component that is the entry point of your app, you will get

Caused by: java.awt.HeadlessException

To solve this, in your Application class in main, instead of:

SpringApplication.run (Application.class, args)

use

SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
builder.headless(false);
ConfigurableApplicationContext context = builder.run(args);
相关文章
|
4月前
|
Java API 容器
java的图形化界面编程AWT与Swing学习记录与分享(其一container容器)
java的图形化界面编程AWT与Swing学习记录与分享(其一container容器)
53 0
|
7月前
|
网络安全
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://xxxx.svc.cluster.local:8080/xxxx": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "xxxx.svc.cluster.local:8080/xxxx ": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
913 0
|
6月前
|
Java API Maven
【异常】Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
【异常】Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
54 0
|
17天前
|
Java 应用服务中间件 Linux
Caused by: java.lang.UnsatisfiedLinkError: /root/jdk1.7.0_45/jre/lib/amd64/xawt/libmawt.so: libXrend
Caused by: java.lang.UnsatisfiedLinkError: /root/jdk1.7.0_45/jre/lib/amd64/xawt/libmawt.so: libXrend
|
23天前
|
Java 开发工具 计算机视觉
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
4 0
|
1月前
|
监控 NoSQL Java
Spring Boot集成Redis启动失败【Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G】
Spring Boot集成Redis启动失败【Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G】
|
1月前
|
SpringCloudAlibaba Java Maven
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
13 2
|
1月前
|
开发工具
933.【开发工具】解决idea:Caused by: java.net.BindException: Add
933.【开发工具】解决idea:Caused by: java.net.BindException: Add
23 2
|
2月前
|
Java 应用服务中间件
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallablePro
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallablePro 错误处理
62 0
|
6月前
|
运维 Java 应用服务中间件
【Nginx异常】无法加载响应数据:No data found for resource with given identifier,后端服务报Caused by: java.io.IOExcepti
【Nginx异常】无法加载响应数据:No data found for resource with given identifier,后端服务报Caused by: java.io.IOExcepti
905 0