Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

At the moment, I try to install Arduino on my Ubuntu 10.04 (32 Bit) computer. I downloaded the latest release at http://arduino.cc/en/Main/Software, cd'ed to the directory and unziped the package. When I try to run ./arduino , I get following error:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at processing.app.Base.main(Base.java:112)
Caused by: java.awt.HeadlessException
    at sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:231)
    at processing.core.PApplet.<clinit>(Unknown Source)
    ... 1 more

Here is my java -version output:

java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.5) (6b20-1.9.5-0ubuntu1~10.04.1)
OpenJDK Server VM (build 19.0-b09, mixed mode)

Any suggestions on this? I try to install arduino without the 'arduino' package.

I tried to install it with apt-get (sudo apt-get install arduino).

When I try to start arduino (using arduino command) will cause following error:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at processing.app.Preferences.load(Preferences.java:553)
    at processing.app.Preferences.load(Preferences.java:549)
    at processing.app.Preferences.init(Preferences.java:142)
    at processing.app.Base.main(Base.java:188)
Caused by: java.awt.HeadlessException
    at sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:231)
    at processing.core.PApplet.<clinit>(PApplet.java:224)
    ... 4 more

Update: I saw that I installed several versions of jre (sun and open). So I uninstalled the open jre.

Now, when calling arduino I get a new error:

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
    at processing.app.Editor.populateSerialMenu(Editor.java:965)
    at processing.app.Editor.buildToolsMenu(Editor.java:717)
    at processing.app.Editor.buildMenuBar(Editor.java:502)
    at processing.app.Editor.<init>(Editor.java:194)
    at processing.app.Base.handleOpen(Base.java:698)
    at processing.app.Base.handleOpen(Base.java:663)
    at processing.app.Base.handleNew(Base.java:578)
    at processing.app.Base.<init>(Base.java:318)
    at processing.app.Base.main(Base.java:207)
share|improve this question
    
You don't say why you don't want to use a package? –  trojanfoe Feb 15 '11 at 8:41
    
Also the exception relates to AWT - are you running from a Windows environment or a shell? –  trojanfoe Feb 15 '11 at 8:44
    
I tried to run it from Ubuntu 10.04 (Gnome) GUI and Shell. (GUI will do nothing and Shell throws the error) –  Newbie Feb 15 '11 at 8:54
1  
If you found an answer, you should write it as an answer and then accept it. That's okay, as no-one else answered it yet. And that's better, because then this is not unanswered anymore. –  Olli Feb 15 '11 at 12:33
add comment

migrated from stackoverflow.com Feb 15 '11 at 11:35

This question came from our site for professional and enthusiast programmers.

5 Answers

This was solved by copying librxtxParallel.so and librxtxSerial.so to /usr/lib/ and the details on this post: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238062036/all

share|improve this answer
add comment

I also had this problem after installing arduino using apt-get as detailed at http://playground.arduino.cc//Linux/Ubuntu

I found the solution was switching my JDK runtime from 7 to 6 using

sudo update-alternatives --config java
share|improve this answer
add comment

I had this issue with JDK7 installed. I successfully switched back to my JDK6 with this command:

sudo update-alternatives --config java

And that did the trick

share|improve this answer
add comment

By default, the java version used in Ubuntu (and this is still true in 11.10) is the OpenJDK. You can check which version of java is being used with

java -version

at the command line. There are two packages for OpenJDK in Ubuntu, openjdk-6-jre and openjdk-6-jre-headless. The headless version is intended for computers with no GUI. You have the headless version installed, causing this error when the arduino program tries to create GUI elements.

To resolve this problem, install the non-headless version. It will take over from the headless version, and the arduino IDE will start.

apt-get install openjdk-6-jre

When you installed arduino from the repositories this dependency ought to have been taken care of for you. I have raised a bug for this (Bug entry)

share|improve this answer
add comment

The answer has been moved but can't be found at StackOverflow. Anyway, for others to know, a possible solution (worked for me) is to add

-Djava.awt.headless=true

as option in java invocation of Arduino script.

Hope it helps

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.