shortcut to arduino IDE on a linux system

i’m currently running ubuntu 9.10 as my main os and the Arduino IDE (v017) works on it like a charm after following the instructions over at arduino.cc. in short it was just the following two commands in the terminal:

sudo apt-get install sun-java6-jre gcc-avr avr-libc
sudo apt-get remove brltty

after installing these dependencies and removing the conflict with brltty, it was no problem to run the arduino IDE. just downloading and double-clicking the file arduino (a batch script) did the job.

the only inconvenience about it was, that it was not possible to set up a shortcut on the desktop or the menu to start the programm.you always have to navigate to the program folder via terminal or a file manager and click the original batch script to start the IDE. starting a shortcut to it always ended with the following error message:

Exception in thread "main" java.lang.NoClassDefFoundError: processing/app/Base
Caused by: java.lang.ClassNotFoundException: processing.app.Base
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
Could not find the main class: processing.app.Base. Program will exit.

this is a known issue and already documented over at the arduino-site on googlecode. luckily p.d.oliver already posted a fix for the bash-script, that will do the trick. if you are too lazy, to do the changes on your own, you can just download the edited scipt and replace the original one with the new one.

edited script for arduino017:


#!/bin/sh
APPDIR=$(dirname $(readlink -f $0))

for LIB in \
 $APPDIR/java/lib/rt.jar \
 $APPDIR/java/lib/tools.jar \
 $APPDIR/lib/*.jar \
 ;
do
 CLASSPATH="${CLASSPATH:+${CLASSPATH}:}${LIB}"
done
export CLASSPATH

LD_LIBRARY_PATH=$APPDIR/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH

export PATH="${APPDIR}/java/bin:${PATH}"

cd $APPDIR
exec java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base

changes to original:


--- arduino~    2009-08-12 00:00:04.000000000 +0100
+++ arduino    2009-11-18 21:07:43.000000000 +0000
@@ -1,20 +1,21 @@
- #!/bin/sh
+#!/bin/sh

-APPDIR="$(dirname -- "${0}")"
+APPDIR=$(dirname $(readlink -f $0))

 for LIB in \
-    java/lib/rt.jar \
-    java/lib/tools.jar \
-    lib/*.jar \
+    $APPDIR/java/lib/rt.jar \
+    $APPDIR/java/lib/tools.jar \
+    $APPDIR/lib/*.jar \
 ;
 do
-    CLASSPATH="${CLASSPATH}:${APPDIR}/${LIB}"
+    CLASSPATH="${CLASSPATH:+${CLASSPATH}:}${LIB}"
 done
 export CLASSPATH

-LD_LIBRARY_PATH=`pwd`/lib:${LD_LIBRARY_PATH}
+LD_LIBRARY_PATH=$APPDIR/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
 export LD_LIBRARY_PATH

 export PATH="${APPDIR}/java/bin:${PATH}"

-java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base
+cd $APPDIR
+exec java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s