How to interact java with asterisk

Hello, I’m trying to make interaction asterisk-java, and I’ve made a little java program and I followed all instruction about the AGI, my file is located in var/lib/asterisk/agi-bin directory, and it is a executable file(.jar)
but when I make my call, asterisk shows the next message:

“failed to execute …/myprogram.jar exec format error”

what could be the problem? please I need your help, somebody knows where I can found examples on java code interacting with asterisk?

In advance, thanks

You must install asterisk-java library and jdk. please check from voip-info.org

Or have a look at the AGI tutorial at asterisk-java.org/latest/tutorial.html