← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #179862]: Python Vs JAVA for sikuli scripting

 

Question #179862 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/179862

    Status: Open => Answered

RaiMan proposed the following answer:
-- If I wish to use JAVA for scripting
Java itself is not a scripting language, it is principally a compiled language and the resulting byte code is run with the JVM.
So you might use Java in any runnable fashion and use Sikuli's Java API, to access the Sikuli features.

-- which one will be better???
Sinced this depends on many aspects, the question cannot be answered. Principally scripting is "better" for rapid development or "quick-and-dirty" solutions (scripting languages that are nearer to Java are e.g. Scala or Groovy). Other scripting languages like Jython or JRuby have their own grammar, that is not Java compatible, but allow to seamlessly access and use any Java classes, that are made available somehow.

-- will it be possible to run that script using Jython interpreter
plain Java code: no (principally spoken, but there are "complex" possibilities)
You have to pack your features into Java classes, that you can import and use in a Jython script.
One example might be the unit test feature, that selects some test cases from test case classes and runs them using a test runner.

So both in Java and Jython you need at least:

import myClasses;
myClasses.run(some, parameters, given);

Supposing myClasses can be found on Java class path, this should run
both in Java (you still need a main class and a compile-and-run) and in
Jython.

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.