{"action":"created","issue":{"url":"https://api.github.com/repos/jruby/jruby/issues/3660","repository_url":"https://api.github.com/repos/jruby/jruby","labels_url":"https://api.github.com/repos/jruby/jruby/issues/3660/labels{/name}","comments_url":"https://api.github.com/repos/jruby/jruby/issues/3660/comments","events_url":"https://api.github.com/repos/jruby/jruby/issues/3660/events","html_url":"https://github.com/jruby/jruby/issues/3660","id":133315065,"number":3660,"title":"Unhandled Java exception: java.lang.NoClassDefFoundError: Could not initialize class jnr.enxio.channels.Native$SingletonHolder","user":{"login":"dhinojosa","id":410757,"avatar_url":"https://avatars.githubusercontent.com/u/410757?v=3","gravatar_id":"","url":"https://api.github.com/users/dhinojosa","html_url":"https://github.com/dhinojosa","followers_url":"https://api.github.com/users/dhinojosa/followers","following_url":"https://api.github.com/users/dhinojosa/following{/other_user}","gists_url":"https://api.github.com/users/dhinojosa/gists{/gist_id}","starred_url":"https://api.github.com/users/dhinojosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhinojosa/subscriptions","organizations_url":"https://api.github.com/users/dhinojosa/orgs","repos_url":"https://api.github.com/users/dhinojosa/repos","events_url":"https://api.github.com/users/dhinojosa/events{/privacy}","received_events_url":"https://api.github.com/users/dhinojosa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-12T18:49:07Z","updated_at":"2016-02-13T11:24:48Z","closed_at":null,"body":"On Ubuntu 15.10 (Wiley) and any JRuby 9000 version. Any invocation of `jruby` or `jirb` returns the following error (elided to keep it brief)\r\n\r\n```\r\nUnhandled Java exception: java.lang.NoClassDefFoundError: Could not initialize class jnr.enxio.channels.Native$SingletonHolder\r\njava.lang.NoClassDefFoundError: Could not initialize class jnr.enxio.channels.Native$SingletonHolder\r\n                 libc at jnr/enxio/channels/Native.java:69\r\n                write at jnr/enxio/channels/Native.java:112\r\n                write at jnr/enxio/channels/NativeDeviceChannel.java:86\r\n                write at org/jruby/util/io/PosixShim.java:102\r\n...\r\n```\r\n\r\nPer the documentation I checked that `update-alternatives` for both `java` and `javac` were correct:\r\n\r\n```\r\nsudo update-alternatives --config java   \r\n```\r\n\r\n```\r\n  Selection    Path                                            Priority   Status\r\n------------------------------------------------------------\r\n  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode\r\n  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode\r\n  2            /usr/lib/jvm/jdk1.7.0/bin/java                   1         manual mode\r\n  3            /usr/lib/jvm/jdk1.7.0_21/bin/java                1         manual mode\r\n  4            /usr/lib/jvm/jdk1.7.0_45/bin/java                1         manual mode\r\n  5            /usr/lib/jvm/jdk1.7.0_55/bin/java                1         manual mode\r\n  6            /usr/lib/jvm/jdk1.8.0/bin/java                   2         manual mode\r\n  7            /usr/lib/jvm/jdk1.8.0_05/bin/java                1         manual mode\r\n  8            /usr/lib/jvm/jdk1.8.0_40/bin/java                1         manual mode\r\n* 9            /usr/lib/jvm/jdk1.8.0_65/bin/java                1         manual mode\r\n```\r\n\r\n```\r\nsudo update-alternatives --config javac   \r\n```\r\n\r\n```\r\n  Selection    Path                                Priority   Status\r\n------------------------------------------------------------\r\n  0            /usr/lib/jvm/jdk1.8.0/bin/javac      2         auto mode\r\n  1            /usr/lib/jvm/jdk1.7.0/bin/javac      1         manual mode\r\n  2            /usr/lib/jvm/jdk1.7.0_21/bin/javac   1         manual mode\r\n  3            /usr/lib/jvm/jdk1.7.0_45/bin/javac   1         manual mode\r\n  4            /usr/lib/jvm/jdk1.7.0_55/bin/javac   1         manual mode\r\n  5            /usr/lib/jvm/jdk1.8.0/bin/javac      2         manual mode\r\n  6            /usr/lib/jvm/jdk1.8.0_05/bin/javac   1         manual mode\r\n  7            /usr/lib/jvm/jdk1.8.0_40/bin/javac   1         manual mode\r\n* 8            /usr/lib/jvm/jdk1.8.0_65/bin/javac   1         manual mode\r\n```\r\n\r\nThe workaround is to add the following to your favorite profile or rc\r\n\r\n```\r\nexport JRUBY_OPTS=-J-Djava.library.path=/usr/lib64\r\n```\r\n\r\nRequesting either fix, or better documentation on wiki for Ubuntu users\r\n\r\nI can craft a pull-request for docs if needed."},"comment":{"url":"https://api.github.com/repos/jruby/jruby/issues/comments/183645945","html_url":"https://github.com/jruby/jruby/issues/3660#issuecomment-183645945","issue_url":"https://api.github.com/repos/jruby/jruby/issues/3660","id":183645945,"user":{"login":"headius","id":10135,"avatar_url":"https://avatars.githubusercontent.com/u/10135?v=3","gravatar_id":"","url":"https://api.github.com/users/headius","html_url":"https://github.com/headius","followers_url":"https://api.github.com/users/headius/followers","following_url":"https://api.github.com/users/headius/following{/other_user}","gists_url":"https://api.github.com/users/headius/gists{/gist_id}","starred_url":"https://api.github.com/users/headius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/headius/subscriptions","organizations_url":"https://api.github.com/users/headius/orgs","repos_url":"https://api.github.com/users/headius/repos","events_url":"https://api.github.com/users/headius/events{/privacy}","received_events_url":"https://api.github.com/users/headius/received_events","type":"User","site_admin":false},"created_at":"2016-02-13T11:24:48Z","updated_at":"2016-02-13T11:24:48Z","body":"I believe I saw @dhinojosa managed to fix this locally with -J-Djava.library.path=/usr/lib64, correct? The search logic in jnr-ffi or jffi *should* be locating the right path...I guess we're still missing something :-("}}