[1.1.0] Running JRuby scripts: JythonSupport: Not possible to get a Jython on to the classpath!

Asked by Serge

It looks like I cannot update sikulixapi.jar to newer version.

I'm using Rubymine with jruby-1.7.16.1 and java version "1.8.0_45" to write scripts for automation testing. It works fine with one of the old sikulixapi.jar, but it doesn't work with new sikulixapi.jar that was installed by sikulixsetup-1.1.0.jar or sikulixsetup-1.1.0-20151004.231024-183-forsetup.jar (second option was used for installation).

When I tried to use new .jar I had something like:

[error] JythonSupport: Not possible to get a Jython on to the classpath!
[error] RunTimeAPI: *** terminating: JythonHelper: no Jython on classpath

I have this error message on both systems (OS X 10.10 and Win7).

Sorry, but I'm not familiar enough with Sikulix and Ruby. Could somebody explain me what I do wrong?
Why message about Jython appears? I'm not using Jython as scripting language at all...

Thanks in advance,
Sergey.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Serge
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Since this is some script start problem:
could you paste the first few lines of a failing script.

I suppose, you have sikulixapi.jar on the Java classpath, when running a script in Rubymine.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

I just made a test with the latest sikulixapi.jar on Java classpath before running a jirb session on commandline:
irb(main):001:0> require 'Lib/sikulix'
=> true
irb(main):002:0> include Sikulix
=> Object
irb(main):003:0> popup("Hallo")
=> nil
irb(main):004:0>

this worked without problems.

So please check your setup.

Revision history for this message
Serge (pvserge1) said :
#3

Thank you very much for answer.

I have the same for jirb session in case of old sikulixapi.jar:

jruby-1.7.16.1 :002 > require 'sikulix'
 => true
jruby-1.7.16.1 :003 > include Sikulix
 => Object
jruby-1.7.16.1 :004 > popup("Hallo")
 => nil

but with new one I have this:

LoadError: load error: sikulix/sikulix -- java.lang.IllegalAccessError: tried to access class org.sikuli.basics.Debug$CallbackType from class org.sikuli.basics.Debug
 from org/jruby/RubyKernel.java:1065:in `require'
 from /Users/qa/.rvm/rubies/jruby-1.7.16.1/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /Users/qa/.rvm/gems/jruby-1.7.16.1/gems/sikulix-1.1.0.3/lib/sikulix.rb:4:in `(root)'
 from org/jruby/RubyKernel.java:1065:in `require'
 from /Users/qa/.rvm/rubies/jruby-1.7.16.1/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1:in `(root)'
 from /Users/qa/.rvm/rubies/jruby-1.7.16.1/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
 from org/jruby/RubyKernel.java:1101:in `eval'
 from (irb):2:in `evaluate'
 from org/jruby/RubyKernel.java:1501:in `loop'
 from org/jruby/RubyKernel.java:1264:in `catch'
 from org/jruby/RubyKernel.java:1264:in `catch'
 from /Users/qa/.rvm/rubies/jruby-1.7.16.1/bin/jirb:13:in `(root)'

Absolutely not clear why. New .jar is copied to the same folder that previous one because (old jar has been renamed).

Revision history for this message
Serge (pvserge1) said :
#4

PS I tried require 'sikulix' inside one jirb session twice with LoadError, but third time it looks ok.

But in RubyMine I still have

[error] JythonSupport: Not possible to get a Jython on to the classpath!
[error] RunTimeAPI: *** terminating: JythonHelper: no Jython on classpath

Revision history for this message
Serge (pvserge1) said :
#5

Anyway, I will try to check my setup again.

Thanks.

Revision history for this message
RaiMan (raimund-hocke) said :
#6

I have to renew my open-source license for RubyMine to have a look.

... and from comment #1:
Since this is some script start problem:
could you paste the first few lines of a failing script.

... in RubyMine

Revision history for this message
Serge (pvserge1) said :
#7

As I said I'm not familiar enough with Ruby.

I'm using JRuby+Cucumber+Sikuli+Selenium(Watir).
I got errors directly after run .feature. Not sure witch script I need to put here? Do you need env.rb?

The env.rb has following:

# required libraries
require 'allure-cucumber'
require 'cucumber/formatter/progress'
require 'java'
require 'sikulix'
include Sikulix
require 'page-object'
require 'page-object/page_factory'
require 'watir-webdriver'
require 'os'

require 'rspec'
require 'data_magic'
require 'require_all'
require 'rubygems'

# Screen modules
require File.expand_path('../utils', __FILE__)
require File.expand_path('../../support/screens/mainscreen', __FILE__)
require File.expand_path('../../support/screens/traynccmenuscreen', __FILE__)
require File.expand_path('../../support/screens/nccviewscreen', __FILE__)

Revision history for this message
RaiMan (raimund-hocke) said :
#8

where and how do you issue the
run .feature

Revision history for this message
Serge (pvserge1) said :
#9

In Rubymine - right mouse click on desktop_install_win.feature and select "Run desktop_install_win.feature"

*.feature is a cucumber file where all tests are described using Gherkin language. There is no any ruby scripts.

As I now env.rb is running before all others scripts (this is part of cucumber project structure).

Should I create and try simple script without cucumber?

Revision history for this message
RaiMan (raimund-hocke) said :
#10

ok understood.
as mentioned: I have to refresh my RubyMine setup.

Yep, running a simple
popup("Hello")

script might help to get nearer to the problem.

Revision history for this message
Serge (pvserge1) said :
#11

I have created test.rb with the following lines inside:

require 'sikulix'
include Sikulix

popup("Hello")

It works without any errors.

After require 'sikulix' and include Sikulix were removed from test.rb I got the same errors like discribed above. So it looks that for the new .jar I should include these lines in any of my .rb files. In an old version it was enough to use it in env.rb only.

Thanks )

Revision history for this message
charles (charlesedward) said :
#12

Hi,

Am trying to use sikuli with SOAPui. Was following this blog http://lnpguy.blogspot.com.au/2014/02/gui-validation-with-soapui-and-sikuli.html

However, when i try to run grovvy script i get this error
ERROR:java.lang.NoClassDefFoundError: Could not initialize class org.sikuli.script.Screen

Searched intensively on net but couldn't find anything that could answer or tell me what next i could try, closest was this article.
Can anyone help me ?