Bug 839635 - arduino fails to start: java.lang.NoClassDefFoundError gnu/io/CommPortIdentifier
Summary: arduino fails to start: java.lang.NoClassDefFoundError gnu/io/CommPortIdentifier
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: jpackage-utils
Version: 17
Hardware: i386
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Deepak Bhole
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-12 13:15 UTC by Frederick Roth
Modified: 2014-06-12 03:37 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-11 14:47:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Frederick Roth 2012-07-12 13:15:13 UTC
Description of problem:
After installing arduino I get a NoClassDefFound Error when trying to start it.

Version-Release number of selected component (if applicable):
arduino-1.0.4

How reproducible:



Steps to Reproduce:
1. yum install arduino
2. arduino
3. provide a empty directory in the "select folders for sketches" menu
  
Actual results:
Exception in thread "main" java.lang.NoClassDefFoundError: gnu/io/CommPortIdentifier
	at processing.app.Editor.populateSerialMenu(Editor.java:996)
	at processing.app.Editor.buildToolsMenu(Editor.java:698)
	at processing.app.Editor.buildMenuBar(Editor.java:483)
	at processing.app.Editor.<init>(Editor.java:205)
	at processing.app.Base.handleOpen(Base.java:700)
	at processing.app.Base.handleOpen(Base.java:665)
	at processing.app.Base.handleNew(Base.java:561)
	at processing.app.Base.<init>(Base.java:301)
	at processing.app.Base.main(Base.java:190)
Caused by: java.lang.ClassNotFoundException: gnu.io.CommPortIdentifier
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	... 9 more



Expected results:
arduino starts

Comment 1 Peter Oliver 2012-07-15 13:42:12 UTC
gnu/io/CommPortIdentifier should be included with the rxtx package.  Could you check that it's properly installed with:

rpm -V rxtx

Also, you could try the following so we can see what CLASSPATH is getting set to:

bash -x /bin/arduino

Comment 2 Frederick Roth 2012-07-16 06:40:53 UTC
rpm -V returns 0.

rxtx-2.2-0.6.20100211.fc17.1.i686 is installed 

shouldn't it be a dependency of arduino?

I get the following CLASSPATH related errors when using bash -x:

++ /usr/bin/build-classpath ecj jna RXTXcomm
+ LOCAL_CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/java-1.6.0-openjdk-1.6.0.0 does not exist or is not a directory'
+ CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/java-1.6.0-openjdk-1.6.0.0 does not exist or is not a directory:'
+ for lib in '/usr/share/arduino/*.jar'
+ CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/java-1.6.0-openjdk-1.6.0.0 does not exist or is not a directory::/usr/share/arduino/core.jar'
+ for lib in '/usr/share/arduino/*.jar'
+ CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/java-1.6.0-openjdk-1.6.0.0 does not exist or is not a directory::/usr/share/arduino/core.jar:/usr/share/arduino/pde.jar'

I'm not quite shure where JVM_LIBDIR /usr/lib/jvm-exports/java-1.6.0-openjdk-1.6.0.0 does not exist or is not a directory is coming from, but I think that is the problem.

Comment 3 Frederick Roth 2012-07-16 11:53:44 UTC
Ok, I'm sorry, it was my mistake, I forgot that I had set JAVA_HOME some time (maybe years) ago in my bashrc which pointed to a nonexistent java 1.6.

Comment 4 Peter Oliver 2012-07-16 21:08:12 UTC
Could set_classpath in /usr/share/java-utils/java-functions issue an error to STDERR in this case, to make it harder for users to shoot themselves in the foot?

Comment 5 Eugenio Petullà 2012-09-27 01:44:56 UTC
Same problem, today on Fedora 17...

Exception in thread "main" java.lang.NoClassDefFoundError: gnu/io/CommPortIdentifier
	at processing.app.Editor.populateSerialMenu(Editor.java:989)
	at processing.app.Editor.buildToolsMenu(Editor.java:692)
	at processing.app.Editor.buildMenuBar(Editor.java:477)
	at processing.app.Editor.<init>(Editor.java:206)
	at processing.app.Base.handleOpen(Base.java:704)
	at processing.app.Base.handleOpen(Base.java:669)
	at processing.app.Base.handleNew(Base.java:565)
	at processing.app.Base.<init>(Base.java:305)
	at processing.app.Base.main(Base.java:194)
Caused by: java.lang.ClassNotFoundException: gnu.io.CommPortIdentifier
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 9 more

Comment 6 Eugenio Petullà 2012-09-27 01:48:47 UTC
Here is the output of: $ bash -x /bin/arduino


++ id -u
+ [[ 1000 -ne 0 ]]
+ for group in dialout lock
+ groups iGenius
+ grep -q ' : .*\bdialout\b'
+ for group in dialout lock
+ groups iGenius
+ grep -q ' : .*\block\b'
+ [[ -n '' ]]
+ . /usr/share/java-utils/java-functions
++ _JAVA_HOME=
++ '[' -f /etc/java/java.conf ']'
++ . /etc/java/java.conf
+++ JAVA_LIBDIR=/usr/share/java
+++ JNI_LIBDIR=/usr/lib64/java
+++ JAVAJNI_LIBDIR=/usr/share/java-jni
+++ JVM_ROOT=/usr/lib/jvm
+++ JAVACMD_OPTS=
++ '[' -f /home/iGenius/.java/java.conf ']'
++ '[' '!' -z '' -a -d '' ']'
+ MAIN_CLASS=processing.app.Base
+ set_classpath ecj jna RXTXcomm
+ _set_java_home
+ '[' -z '' ']'
+ local _java_dirs=java
+ case "$_prefer_jre" in
+ _java_dirs='java jre'
+ for d in '$_java_dirs'
+ '[' -d /usr/lib/jvm/java ']'
+ for d in '$_java_dirs'
+ '[' -d /usr/lib/jvm/jre ']'
+ jars='ecj jna RXTXcomm'
+ '[' -n '' ']'
++ /usr/bin/build-classpath ecj jna RXTXcomm
+ LOCAL_CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/jre-1.7.0u04-sun-x64 does not exist or is not a directory'
+ CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/jre-1.7.0u04-sun-x64 does not exist or is not a directory:'
+ for lib in '/usr/share/arduino/*.jar'
+ CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/jre-1.7.0u04-sun-x64 does not exist or is not a directory::/usr/share/arduino/core.jar'
+ for lib in '/usr/share/arduino/*.jar'
+ CLASSPATH='/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/jre-1.7.0u04-sun-x64 does not exist or is not a directory::/usr/share/arduino/core.jar:/usr/share/arduino/pde.jar'
+ set_flags -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
+ FLAGS=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
+ '[' -n '' ']'
+ cd /usr/share/arduino
+ run
+ set_javacmd
+ '[' -x '' ']'
+ set_jvm
+ _set_java_home
+ '[' -z '' ']'
+ local _java_dirs=java
+ case "$_prefer_jre" in
+ _java_dirs='java jre'
+ for d in '$_java_dirs'
+ '[' -d /usr/lib/jvm/java ']'
+ for d in '$_java_dirs'
+ '[' -d /usr/lib/jvm/jre ']'
+ '[' -n '' ']'
++ which javac
++ :
+ java=
+ '[' -z '' ']'
++ which java
+ java=/usr/bin/java
+ '[' -n /usr/bin/java ']'
+ '[' -h /usr/bin/java ']'
++ readlink /usr/bin/java
+ java=/etc/alternatives/java
+ '[' -h /etc/alternatives/java ']'
++ readlink /etc/alternatives/java
+ java=/usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/java
+ '[' -h /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/java ']'
++ dirname /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/java
+ JAVA_HOME=/usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/..
+ export JAVA_HOME
+ return
+ '[' -x /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/../jre/sh/java ']'
+ '[' -x /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/../bin/java ']'
+ JAVACMD=/usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/../bin/java
+ '[' '!' -x /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/../bin/java ']'
+ '[' -n '' ']'
+ return 0
+ '[' -n '' ']'
+ exec /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/../bin/java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -classpath '/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/jre-1.7.0u04-sun-x64 does not exist or is not a directory::/usr/share/arduino/core.jar:/usr/share/arduino/pde.jar' processing.app.Base

Comment 7 Eugenio Petullà 2012-09-30 00:40:39 UTC
alternatives --config java

choose JRE 1.7 and set the path:

export JAVA_HOME="/usr/java/latest"

This can solve the problem if someone need... after update of JRE or after installation (if you had jdk before installing jre, like me).

Comment 8 Deepak Bhole 2012-10-10 21:13:16 UTC
What does alternatives --display java say when the error occurs?

Comment 9 Eugenio Petullà 2012-10-10 21:36:19 UTC
$ alternatives --display java
java - stato: manuale.
 il link attualmente punta a /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/java
/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java - priorità 17006
 slave keytool: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/keytool
 slave orbd: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/orbd
 slave pack200: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/pack200
 slave rmid: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/rmid
 slave rmiregistry: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/rmiregistry
 slave servertool: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/servertool
 slave tnameserv: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/tnameserv
 slave unpack200: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/unpack200
 slave jre_exports: /usr/lib/jvm-exports/jre-1.7.0-openjdk.x86_64
 slave jre: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64
 slave java.1.gz: /usr/share/man/man1/java-java-1.7.0-openjdk.1.gz
 slave keytool.1.gz: /usr/share/man/man1/keytool-java-1.7.0-openjdk.1.gz
 slave orbd.1.gz: /usr/share/man/man1/orbd-java-1.7.0-openjdk.1.gz
 slave pack200.1.gz: /usr/share/man/man1/pack200-java-1.7.0-openjdk.1.gz
 slave rmid.1.gz: /usr/share/man/man1/rmid-java-1.7.0-openjdk.1.gz
 slave rmiregistry.1.gz: /usr/share/man/man1/rmiregistry-java-1.7.0-openjdk.1.gz
 slave servertool.1.gz: /usr/share/man/man1/servertool-java-1.7.0-openjdk.1.gz
 slave tnameserv.1.gz: /usr/share/man/man1/tnameserv-java-1.7.0-openjdk.1.gz
 slave unpack200.1.gz: /usr/share/man/man1/unpack200-java-1.7.0-openjdk.1.gz
/usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/java - priorità 18000
 slave keytool: (null)
 slave orbd: (null)
 slave pack200: (null)
 slave rmid: (null)
 slave rmiregistry: (null)
 slave servertool: (null)
 slave tnameserv: (null)
 slave unpack200: (null)
 slave jre_exports: (null)
 slave jre: (null)
 slave java.1.gz: (null)
 slave keytool.1.gz: (null)
 slave orbd.1.gz: (null)
 slave pack200.1.gz: (null)
 slave rmid.1.gz: (null)
 slave rmiregistry.1.gz: (null)
 slave servertool.1.gz: (null)
 slave tnameserv.1.gz: (null)
 slave unpack200.1.gz: (null)
La migliore versione attuale è /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/java.

I translate for you (it's italian): java - status: manual. (first row)

Best version is /usr/lib/jvm/jre-1.7.0u04-sun-x64/bin/java. (last row)


I recreated the problem, restarting my laptop and not exporting the classpath with: export JAVA_HOME="/usr/java/latest" (this command solved my problem, but I have to redo it everytime I restart my laptop)

Comment 10 Deepak Bhole 2012-10-11 14:47:32 UTC
Looks like you tried to manually install the Oracle JRE alternative. Such a configuration is unfortunately not supported so I will have to close this issue ( I wasn't aware that the proprietary JDK was being used).

There is OpenJDK7 (java-1.7.0-openjdk{,-devel}) in Fedora that you can use instead. Or, if you absolutely must use the Oracle one, you can run rpm -q --scripts java-1.7.0-openjdk and rpm -q --scripts java-1.7.0-openjdk-devel and mimic the alternative install commands with appropriate path changes.

Comment 11 Eugenio Petullà 2012-10-11 14:54:31 UTC
Thanks a lot! I need the oracle one... but I can mange it in order to use what I need with arduino... thanks anyway... very usefull!

Comment 12 Robin Laing 2014-06-12 03:37:25 UTC
I had this problem on F19 and fixed it by making a simlink to the missing directory.

   sudo  ln -s java /usr/lib/java-1.7.0

Arduino now starts and runs.

Just adding this as a helper if someone is looking for a solution.

The 

   bash -x /bin/arduino

pointed me to the missing directory link.


Note You need to log in before you can comment on or make changes to this bug.