element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum swing application error on BBB
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 28 replies
  • Subscribers 483 subscribers
  • Views 3069 views
  • Users 0 members are here
Related

swing application error on BBB

ramanc51
ramanc51 over 10 years ago

Hi all

          I am getting following error while i run my java swing app through linux script, but no error while executing by java -jar myapp.jar on shell, is there any clue to resolve this error

 

java.awt.eventqueue3.run

java.security.accesscontroller.doPrevilidged(native method)

java.security.protectiondomain$javasecurityaccessimpl.dointersection

java.awt.eventqueue.dispatchevent

  • Sign in to reply
  • Cancel

Top Replies

  • clem57
    clem57 over 10 years ago +1
    What is your linux script source?
  • clem57
    clem57 over 10 years ago in reply to ramanc51 +1
    ramanc51 Key message is HeadlessException (Java Platform SE 6) and No X11 DISPLAY variable was set, but this program performed an operati...s it. This means you need X windows environment properly set…
  • mconners
    mconners over 10 years ago in reply to ramanc51 +1
    The one who owns the display is the user that is logged in. You are starting a service as one of the system users, I'm not sure which one, because I don't have access to your system. X11 will prevent users…
Parents
  • clem57
    clem57 over 10 years ago

    What is your linux script source?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • ramanc51
    ramanc51 over 10 years ago in reply to clem57

    i saved my script in /usr/bin/myscript.sh

     

    #!/bin/bash

    java - jar /home/debian/myapp.jar

     

    trying to execute from my myapp.service that saved on /usr/lib/systemd/system and symliked to /etc/systemd/system

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • ramanc51
    ramanc51 over 10 years ago in reply to ramanc51

    Thanks, for reply, find the complete error below

     

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: Jar version = RXTX-2.2pre1

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: native lib Version = RXTX-2.2pre2

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: Exception in thread "main" java.awt.HeadlessException:

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: No X11 DISPLAY variable was set, but this program performed an operati...s it.

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.Window.<init>(Window.java:536)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.Frame.<init>(Frame.java:420)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.Frame.<init>(Frame.java:385)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at javax.swing.JFrame.<init>(JFrame.java:189)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at token.TokenUpdaterGUI.main(TokenUpdaterGUI.java:282)

    debian@beaglebone:~$

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mconners
    mconners over 10 years ago in reply to ramanc51

    In the OP you list the following errors:

    java.awt.eventqueue3.run

    java.security.accesscontroller.doPrevilidged(native method)

    java.security.protectiondomain$javasecurityaccessimpl.dointersection

    java.awt.eventqueue.dispatchevent

     

    then when you state "find the complete error below"

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: Jar version = RXTX-2.2pre1

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: native lib Version = RXTX-2.2pre2

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: Exception in thread "main" java.awt.HeadlessException:

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: No X11 DISPLAY variable was set, but this program performed an operati...s it.

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.Window.<init>(Window.java:536)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.Frame.<init>(Frame.java:420)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at java.awt.Frame.<init>(Frame.java:385)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at javax.swing.JFrame.<init>(JFrame.java:189)

    Feb 18 17:54:23 beaglebone QMServer.sh[1404]: at token.TokenUpdaterGUI.main(TokenUpdaterGUI.java:282)

     

    they don't show the same errors.

     

    several things

     

    1) In the second set of error messages, it says "no X11 DISPLAY variable set", which is probably why it can't display and gives you awt errors. Could you add a line to your bash script, prior to executing the java command

     

    echo $DISPLAY

     

    and we'll see what that returns

     

    2) Are logged in with a bash shell?

     

    3) Are you running the script as

    bash myscript.sh

     

    or just

     

    myscript.sh

     

    4) change your script

    #!/bin/bash

    echo $DISPLAY

    cd /home/debian

    java - jar myapp.jar

     

    and see if that give a different result

     

    Mike

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • clem57
    clem57 over 10 years ago in reply to ramanc51

    ramanc51

         Key message is HeadlessException (Java Platform SE 6) and No X11 DISPLAY variable was set, but this program performed an operati...s it.

    This means you need X windows environment properly set up inside the bash shell which is normally a text based environment. To overcome this, you will need to start X11 process with the application as startup. Or avoid doing any graphical commands in your source.

    Clem

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • mconners
    mconners over 10 years ago in reply to clem57

    clem57 he did say it runs from the command line, so it may just be that the DISPLAY variable is not being passed to the subprocess spawned when he runs the bash script.

     

    he may just have to do an

     

    export DISPLAY=value prior to running the script so that the subprocess has access to it, or add to his .bashrc

     

    Mike

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • ramanc51
    ramanc51 over 10 years ago in reply to mconners

    Thank you mike, yes both error are for different java GUI app but difference is number of GUI elements, prior higher later lower, now my answer

     

    1. echo $DISPLAY added prior to java program, no result same error, but this time one extra line i saw that is :0.0
    2. I do not know which is default shell on BBB, on desktop there is LXTerminal, i am using that
    3. NO, i am not running as you said, i just tested as given bellow

          cd /usr/bin # i stored my script here

          ./myscript.sh

      Both app are working here, i am also tested as following

        cd /usr/bin

        bash myscript.sh,

    it is also working.

     

       4. I added as you said no result

     

    Actually my intention is to start my app automatically after BBB boot for that i did following

     

    i created my myapp.service that saved on /usr/lib/systemd/system and symliked to /etc/systemd/system     H

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • ramanc51
    ramanc51 over 10 years ago in reply to mconners

    Hi Mike, on your reply to clem57, you said export DISPLAY=value, here value=?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mconners
    mconners over 10 years ago in reply to ramanc51

    value would be :0.0 or localhost:0.0 based on what you typed above

     

    so

     

    export DISPLAY=localhost:0.0

     

    Mike

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mconners
    mconners over 10 years ago in reply to ramanc51

    Raman Arumugam wrote:

     

     

    Actually my intention is to start my app automatically after BBB boot for that i did following

     

     

    That might be a problem for the reasons clem57 stated, you need to have the xserver started prior to running your program.

     

    Raman Arumugam wrote:

     

    1. NO, i am not running as you said, i just tested as given bellow

          cd /usr/bin # i stored my script here

          ./myscript.sh

      Both app are working here, i am also tested as following

        cd /usr/bin

        bash myscript.sh,

    it is also working.

     

    I'm now confused, is the script working now?

     

    also, try typing

    echo $SHELL

    to see if it tells you which shell you are running

     

    or if that doesn't produce anything

    grep <your username> /etc/passwd

     

    I think you had indicated you are using user debian, so

     

    grep debian /etc/passwd

     

    the last entry will tell you your default shell

     

    Mike

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • ramanc51
    ramanc51 over 10 years ago in reply to mconners

    Hi Mike after changing as you said export DISPLAY=localhost:0.0, i got following error message, QMServer.service is my service to auto start my java app through QMServer.sh

     

    debian@beaglebone:/usr/bin$ sudo systemctl daemon-reload

    debian@beaglebone:/usr/bin$ sudo systemctl start QMServer.service

    debian@beaglebone:/usr/bin$ systemctl status QMServer.service

    QMServer.service - QMServer

          Loaded: loaded (/lib/systemd/system/QMServer.service; enabled)

          Active: failed (Result: exit-code) since Thu, 18 Feb 2016 20:11:56 +0530; 11s ago

         Process: 1936 ExecStart=/usr/bin/QMServer.sh (code=exited, status=1/FAILURE)

          CGroup: name=systemd:/system/QMServer.service

     

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEn...a:82)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:126)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.lang.Class.forName0(Native Method)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.lang.Class.forName(Class.java:264)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.awt.Toolkit$2.run(Toolkit.java:860)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.awt.Toolkit$2.run(Toolkit.java:855)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.security.AccessController.doPrivileged(Native Method)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)

    Feb 18 20:11:56 beaglebone QMServer.sh[1936]: at sun.swing.SwingUtilities2.getSystemMnemonicKeyMask(SwingUtilities2....2020)

    debian@beaglebone:/usr/bin$

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • ramanc51
    ramanc51 over 10 years ago in reply to mconners

    For command grep debian /etc/passwd, i got following message

    debian:x:1000:1000:Demo User:/home/debian:bin/bash

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • ramanc51
    ramanc51 over 10 years ago in reply to mconners

    For command grep debian /etc/passwd, i got following message

    debian:x:1000:1000:Demo User:/home/debian:bin/bash

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • mconners
    mconners over 10 years ago in reply to ramanc51

    That means by default you are running the bash shell, that's good, I just wanted to verify

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube