[jruby-user] NameError: class not found in packages

Arthur Khachatryan <[email protected]> Tue, 31 Mar 2015 21:33:29 +0200
Newsgroups gmane.comp.lang.jruby.user
Message-ID <[email protected]>
Hi,

I appreciate if somebody will help me to understand and resolve the
problem I have.

I have in BaseClass.java file the following class and while I create a
class object in a Ruby file it gets into an error if I have not
commented the instantiating of 'webDriver' ( see below ).
With the commented 'webDriver' I can call func1() and func2() Java
methods from Ruby code ( jruby test.rb ===> calling Java methods from
test.rb )

Please note that Java compilation passes with no errors and I create
then put the classes JAR file in $CLASSPATH in my Ruby file ( $CLASSPATH
<< "the_classes_jar_file" )

Without commented the 'webDriver' I am getting the following error:

....

: NameError: BaseClass not found in packages p1; last error: cannot link
Java class p1.BaseClass,probable missing dependency:
org/openqa/selenium/WebDriver

....

Here is the class:

package p1;

import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.ie.*;

public class BaseClass
{
  protected static WebDriver webDriver  = null;

    public void configureParameters( String firefoxProfileDir )
    {
       this.firefoxProfileDir = firefoxProfileDir;
       java.io.File profilefile = new File(this.firefoxProfileDir);
       FirefoxProfile profile = new FirefoxProfile(profilefile);
       profile.setAcceptUntrustedCertificates(false);
 //    webDriver = new FirefoxDriver(profile);
    }

   public void func1()
   {
      System.out.println("calling func1 from BaseClass");
   }

   public void func2()
   {
      System.out.println("calling func2 from BaseClass");
   }
}

-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email