linux java no x11_在linux下运行javaMail程序报No X11 DISPLAY variable was...
收藏
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.List.(List.java:216)
at java.awt.List.(List.java:171)
at com.mail.MailSendWork.(MailSendWork.java:40)
at com.mail.MailWorker.run(MailWorker.java:30)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Thread.java:595)
在 java classname 中間加上 -Djava.awt.headless=true
再次執行還是報錯
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.List.(List.java:216)
at java.awt.List.(List.java:171)
at com.mail.MailSendWork.(MailSendWork.java:40)
at com.mail.MailWorker.run(MailWorker.java:30)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Thread.java:595)
看來不好使,刪掉。在環境變量中加入 export DISPLAY=localhost:0 再次執行 ,OK!
總結
以上是生活随笔為你收集整理的linux java no x11_在linux下运行javaMail程序报No X11 DISPLAY variable was...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java if emun_关于java:
- 下一篇: matlab启动不了jvm,MATLAB