I am trying to run Java swing application on raspberry pi (Model B revision 2) using Putty console. however when I run the command
java -jar myjar.jar
it throws exception:
Exception in thread "main" 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:207)
at java.awt.Window.<init>(Window.java:536)
at java.awt.Frame.<init>(Frame.java:420)
at javax.swing.JFrame.<init>(JFrame.java:225)
...............
I used to set display level as
export DISPLAY=:0.0
however it did not work. Readed all related SO posts however did not came to solution. please help me.
As you wrote you want to have the raspberry run a program and send its output to your window manager XMing on your Windows PC.
Because of this you need to tell on which PC you want the display, your current setup tries to display on the raspberry.
export DISPLAY=nameofwindowspc:0.0
Replace nameofwindowspc
with the name of your PC or its IP address. More information about X and the variable can be found on the web, for example here: http://www.hungry.com/~jamie/xexport.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.