How to make a jar-file from github repository?

Hi, please can someone tell me, how i can make a jar-file from a github repository?

I´m on latest debian with OH2.

Hey @halloween you can download the .kar files from CloudBees.
You have to put the .kar files into the ./openhab/addons/ folder and openHAB will extract them to the following path with the jar files.

Hope this solves your problem :slight_smile:

edit# Please note that the “openhab-addons-2.1.0-SNAPSHOT” can have a different name if you download a different version.

Manual style would be: Clone the GIT
"cd openhab2-addons/addons/binding"
create the jar
"jar cf org.openhab.binding.mihome.jar org.openhab.binding.mihome"
Please note you have to make the jar executable “sudo chmod +x org.openhab.binding.mihome.jar”

SORRY! Typo!
It must be jar cf org.openhab.binding.mihome.jar org.openhab.binding.mihome

@BrutalBirdie I tried your steps above to learn how to create the jar file -

Manual style would be: Clone the GIT
"cd openhab2-addons/addons/binding"
create the jar
"jar cv org.openhab.binding.mihome.jar org.openhab.binding.mihome"

However I was not successful in creating a working jar file. I initially clone the GIT as mentioned above and then go and grab and installed JDK for Windows before executing the “jar cvf …” command. A proper org.openhab.binding.mihome.jar file was created, but it doesn’t work and was slightly smaller in size at around 71KB versus the one I downloaded which is around 79KB. When I copied the jar file into the addons folder, the binding doesn’t appear in the Paper UI / Configuration / Bindings page. What am I missing?

Just take the .kar files and copy or move them into your Addons folder.

@BrutalBirdie I’m trying to have a go at learning how to build the jar file and then hopefully add the new devices. It doesn’t seem to be an easy way. If I can’t even compile a working jar file I won’t be able to proceed. Searching more web pages…

This one seems promising -
but I got stuck in step 4 of installation.

@CoolWombat I am really sorry, I made a typo…
it must be jar cf org.openhab.binding.mihome.jar org.openhab.binding.mihome

@BrutalBirdie Thanks for that. Yes, I have sort of figured that one out and went with cvf as mentioned above. I am still stuck in that the .jar file I created doesn’t work and is slightly smaller in size at around 71K versus the official one which is around 79K. I haven’t had time to look into it further and actually open up the jar file and see which files are different. Were you able to generate a working jar file using this method?

Yes, my jar was working.

For Historical reason.

sorry to revive an old thread, but im trying this with the mcp23017 binding to change it so that a switch will be low on and high off, however the jar file produced does not install, even tho its in the addon folder and it has the right permissions.
isnt it supposed to install automaticly?
or do i have to install it through paper ui and if so, how do i make sure its installing the custom one i made changes to and not the one i used before?

Nvm, it installed now … idk why it didnt work the first 10 times i tried, but i guess 11 did the job

1 Like