How to Setup Jython

/usr/share/openhab2

under /etc/default there is no openhab2 directory

@mjcumming remove what you added to start.sh

See post #54, that’s what /etc/default/openha2 needs to look like.

Restart OH sudo systemctl restart openhab2.service

Or not… I use a manual installation and prefer to keep everything for OH under one directory (easy backup). So, I use start.sh. Either way works.

Did you install manually, or other?

openhabian install - under etc/default I see the openhab2 file - sorry thought I was to create a start.sh file in an openhab2 directory…

I removed the changes to start.sh and made the changes to opehab2.

restarting…

If installing using openhabian image, jython was broke when using start.sh. Is this a bug with the latest snapshot only?

FYI for openhabian the start.sh is located in /usr/share/openhab2

ok, progress :slight_smile:

2018-10-09 14:25:29.749 [DEBUG] [rt.internal.loader.ScriptFileWatcher] - in queue: {md=[file:/etc/openhab2/automation/jsr223/000_components/README.md]}

2018-10-09 14:25:29.752 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script '000_HelloWorld.py'

2018-10-09 14:25:29.945 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/000_HelloWorld.py': ImportError: No module named openhab in <script> at line number 3

2018-10-09 14:25:29.946 [DEBUG] [rt.internal.loader.ScriptFileWatcher] - Script loaded: 000_HelloWorld.py

No no. Nothing was broken other than my understanding of an apt-get install. My bad. I’m working on the documentation now.

Please show us what you put in /etc/default/openhab2.


EXTRA_JAVA_OPTS="-Xbootclasspath/a:/etc/openhab2/automation/jython/jython-standalone-2.7.0.jar \ -Dpython.home=/etc/openhab2/conf/automation/jython \ -Dpython.path=/etc/openhab2/conf/automation/lib/python"


No backslashes … see the pic above.

1 Like

Take out the \ s and restart OH.

1 Like

Openhabian install is just like this, all on one line. Go to /ect/default and use text editor to change openhab2 file. e.g. cd /etc/default/ sudo nano openhab2

Place this between the " " at EXTRA_JAVA_OPTS=" "

Note: Change the version of jar if using something other than 2.7.0 e.g 2.7.1

EXTRA_JAVA_OPTS="-Xbootclasspath/a:/etc/openhab2/automation/jython/jython-standalone-2.7.0.jar -Dpython.home=/etc/openhab2/automation/jython -Dpython.path=/etc/openhab2/automation/lib/python"

README is updated. Do you think it is clear enough?

1 Like

Super clear to me, great job!:+1:

1 Like

ok, its working :slight_smile: :slightly_smiling_face:

I removed the quotes around the line…

EXTRA_JAVA_OPTS=-Xbootclasspath/a:/etc/openhab2/automation/jython/jython-standalone-2.7.0.jar -Dpython.home=/etc/openhab2/automation/jython -Dpython.path=/etc/openhab2/automation/lib/python

will Lucid work with this version of the jython library?

Not sure, you may have to test and see. This is the first time to install jython for me, I was more along for the install testing, maybe try and help Scott as well as the community.

But, guess now I need to start learning how to code and remove the Rules DSL prop.:smile:

@5iver anything else to try with apt install?

Sounds like we are doing the same thing. I am guessing the purpose of lucid is to make it easier to create rules using jython…