Invoke a Java class by name

My DSL generates Java code but I also have an interpreter that works on MPS.
For the operators, it's very simple to provide the behaviour and collect the result; however my DSL also provides functions which are available as Java Jar files.
I don't want to statically refer to the Java classes/methods, so I tried to use dynamic loading but I can never find these classes.
Has anyone tried out a scenario like this?
Any suggestions?


Sérgio Ribeiro
Portugal.
2 comments
The parameters identify the very specific method you need if there are several overloaded available, if the method has no arguments, only give methodName.
0
I've managed to get it right with some help off-forum.
If someone else has this problem: I was adding the JARs as stubs but what I should have done was add them as Libraries in the solution (see pic).

Libraries.png

After this step, dynamic loading worked perfectly.
0

Please sign in to leave a comment.