From f4c260f2ffda8f6790172b7f74e1b4337369a4ca Mon Sep 17 00:00:00 2001 From: theiding Date: Fri, 17 Apr 2020 23:25:11 -0700 Subject: [PATCH] Installation details Added more details around the installation and configuration process. Fixed that engine no longer logs "Activated scripting support..." Signed-off-by: Mark Theiding --- configuration/jsr223-jython.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/configuration/jsr223-jython.md b/configuration/jsr223-jython.md index 1114713514..0207286f59 100644 --- a/configuration/jsr223-jython.md +++ b/configuration/jsr223-jython.md @@ -10,8 +10,10 @@ title: JSR223 Jython Scripting ## Configuration [Download](https://jython.github.io/index) the Jython 2.7.0 standalone or installer package, or install through a package repository. -Newer versions are not yet supported. -Install Jython on the local filesystem and make note of the installation directory location. +Install Jython on the local filesystem into a directory of your choice. +A good installation directory is `/etc/openhab2/automation/jython`. +For the easiest installation mechanism simply download `jython-standalone-2.7.0.jar` and copy it into your installation directory. Alternatively you can execute the installer and specify your installation directory during the install. +Note that newer versions than 2.7.0 are not yet supported. The Jython implementation will need to be added to openHAB's Java classpath. How this is done depends on the specific installation technique and operating system. @@ -26,6 +28,9 @@ EXTRA_JAVA_OPTS="-Xbootclasspath/a:/etc/openhab2/automation/jython/jython-standa This will add the Jython library to the Java classpath, set the Jython home directory and specify the initial Python path for the Jython runtime. +Specifically `bootclasspath` must point to your installation directory plus the Jython library, which is +`jython-standalone-2.7.0.jar` if you copied the jar directly or `jython.jar` if you ran the installer. +Similarly `python.home` points to your installation directory. Python modules and packages can be installed into the `python.path` locations and imported from scripts. Note that library modules and packages are not automatically reloaded when they change. @@ -44,16 +49,9 @@ or viewing the `openhab.log` file directly). You should see a log line with information similar to: ```text - ... [INFO ] [s.i.GenericScriptEngineFactory:28 ] - Activated scripting support for ECMAScript - ... [INFO ] [s.i.GenericScriptEngineFactory:28 ] - Activated scripting support for python - ... ... [INFO ] [.a.m.s.r.i.l.ScriptFileWatcher:150 ] - Loading script 'test.py' ``` -::: tip Note -ECMAScript is Javascript -::: - Look for any potentially related error messages. To enable debug logging, use the [Karaf logging]({{base}}/administration/logging.html) commands to