file Java package installation

10 years 9 months ago #90 by nguyenhoai
Hi

I was searching the web to get some jython help, and I saw that java packages could easily be used within jython.

Could someone tell me how to install java packages *.jar and *.dll in Modelio's Jython distribution ?

thanks

Please Log in or Create an account to join the conversation.

10 years 9 months ago - 10 years 9 months ago #92 by cma
Hello,

The java packages (and native dlls) must be accessible by the java class loader used by Jython in order to be accessible. If it is already the case you just have to code
sys.add_package("my.java.package")
from my.java.package import MyClass

If you want to use packages not provided with Modelio, the simpliest is to create a Modelio module that contains and references the .jar.
Deploying the module will then make the jars accessible.
You can refer to the Module Contributor's Guide for more informations for how to create module.
The following user(s) said Thank You: andy

Please Log in or Create an account to join the conversation.

10 years 9 months ago #93 by nguyenhoai
Thanks
i'll try that as soon as possible.

Please Log in or Create an account to join the conversation.

10 years 9 months ago #97 by nguyenhoai
Hi,

I tried an other way actually.
In order to let Jython access java packages, I've just put *.dll and *.jar in Java distrib comming with Modelio, respectively in <Dir>\modelio\jre\bin and <Dir>\modelio\jre\lib\ext.

I known it is kind of messy but it worked when I added in my jython script what you told me :
sys.add_package("my.java.package")
from my.java.package import MyClass

I am just learning Python as well as Jython and modelio API...

thanks again

Please Log in or Create an account to join the conversation.

Moderators: chmcma
Time to create page: 0.037 seconds
^ Back to Top