# RJB - getting NoClassDefFoundError on import of JAVA class

**URL:** <https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847>\
**Category:** Ruby\
**Created:** [September 12, 2010, 7:55am UTC](https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847 "2010-09-12T07:55:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [September 12, 2010, 7:55am UTC](https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847/1 "2010-09-12T07:55:11Z")

</div>

Hi,

I am using rjb gem, and trying to import a JAVA class. The JAVA API  
documentation is located at:

[http://www.jarvana.com/jarvana/view/com/jayway/android/robotium/robotium-solo/1.1.1/robotium-solo-1.1.1-javadoc.jar!/com/jayway/android/robotium/solo/Solo.html](http://www.jarvana.com/jarvana/view/com/jayway/android/robotium/robotium-solo/1.1.1/robotium-solo-1.1.1-javadoc.jar!/com/jayway/android/robotium/solo/Solo.html)

I have installed jdk, and installed the relevant jar files, and using  
the following code:

require ‘rjb’

c =  
“c:/robotium/robotium-solo-1.7.1.jar;c:/robotium/robotium-solo-1.7.1-javadoc.jar”  
Rjb::load(classpath = c, jvmargs=[])  
@rapi = Rjb::import(‘com.jayway.android.robotium.solo.Solo’)  
puts “robotium\_class=#{@rapi.inspect}”

But, it fails to import this class, and throws the following error:

> ruby test\_robotium.rb  
> test\_robotium.rb:11:in `import’: android/view/View  
> (NoClassDefFoundError)  
> from test\_robotium.rb:11  
> Exit code: 1

Any help on this would be appreciated. To download the relevant jar  
files, goto [http://code.google.com/p/robotium/downloads/list](http://code.google.com/p/robotium/downloads/list)

Thanks,  
Anukul

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [September 12, 2010, 4:42pm UTC](https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847/2 "2010-09-12T16:42:00Z")

</div>

Hi

I believe your path string need to escape the path separator.  
eg)  
c =  
“c://robotium//robotium-solo-1.7.1.jar;c://robotium//robotium-solo-1.7.1-javadoc.jar”

Please try above setting.

–  
arton [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [September 12, 2010, 7:00pm UTC](https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847/3 "2010-09-12T19:00:55Z")

</div>

arton wrote:

> Hi
> 
> I believe your path string need to escape the path separator.  
> eg)  
> c =  
> “c://robotium//robotium-solo-1.7.1.jar;c://robotium//robotium-solo-1.7.1-javadoc.jar”
> 
> Please try above setting.
> 
> –  
> arton [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Hi Arton,

Thanks for the response. But I get the same error.

I believe the escape sequence would be required if I use "" (back  
slash), for “/” (forward slash), dont think we need to provide an extra  
“/”.

Let me know if there is any other setting I am missing.

Thanks,  
Anukul

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [September 13, 2010, 12:44am UTC](https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847/4 "2010-09-13T00:44:21Z")

</div>

Ah,

You need to use \ for the directory separator, because the  
classspath is consumed by Java.

Regards
