Eclipse Scout SDK: New Feature for Simple JAR Import

With the new 3.8 Juno release the Scout SDK offers support to integrate external JAR files into a Scout application with a few clicks. To demonstrate this new Scout SDK feature we recently added a tutorial  that shows how you can add  Jython (=Python for Java) support into your Scout application.

The screenshots below show how a new bundel containing the jythonlib.jar is created and added to the Scout client application.

After this step, jython is available in the client Scout application. The listing below shows how Jython can be invoked on the ‘Run’ button of the initial screenstho above.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@Override
protected void execClickAction() throws ProcessingException {
  getResultField().clearErrorStatus();
  try {
    // get interpreter, read input variable from input field
    PythonInterpreter pi = new PythonInterpreter();
    pi.set(getInputField().getValue(), new PyString(getLineField().getValue()));
 
    // run script, transfer output to result field
    pi.exec(getPythonField().getValue());
    getResultField().setValue(pi.get(getOutputField().getValue()).asString());
  }
  catch (Exception e) {
    getResultField().setValue(null);
    getResultField().setErrorStatus(e.toString());
  }
}

For more details, check out the tutorial.

Scout Links: Project Home, Forum, Wiki, Twitter