Importing external jar files in MPS 3.4.1

Hi all,

I'm trying to import external java jar file into my code and followed the steps suggested in different posts in this forum but it does not seem to work.

The steps I'm following are:

1.) Copy the jar file next to the *.mpl file of my language.


 

2.) Adding root model (java_classes) in my language pointing to this *.jar file.

 

3.) Trying to load the model from my jar file into my plugin (since I want to use the library there)

 

But unfortunately I couldn't find the library.

 

3 comments
Comment actions Permalink

Thanks Vaclav, that worked. But I'm now facing another issue with compiling my imported external java source files.

My external java source files use other 3rd party libraries and they are placed in my java project in the lib folder and this perfectly compiles in ecplise. But MPS cannot resolved these 3rd party libraries.

 

My imported java source folder (which I imported in MPS) looks like this: Where lib folder contains 3rd party libraries which my source code is using and src folder contains my code which I want to use in MPS project.

 

0
Comment actions Permalink

Hi Hassan, I met the same problem as yours (which is the compiler can't resolve the 3rd party libraries).

My suggestion is do not import a directory containing several jar packages, import them one by one instead. It perfectly solve the problem for me. Actually, I remember IntelliJ don't support directly import a directory into project library as well.

It works for me, hope it will help you :-)

0

Please sign in to leave a comment.