Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Using custom Java Methods with emftvm(While using ATL i reached a point where java methods would be helpful, but i get some errors.)
Using custom Java Methods with emftvm [message #1804178] Wed, 20 March 2019 03:46 Go to next message
Tai Ly is currently offline Tai LyFriend
Messages: 3
Registered: February 2019
Junior Member
Hello,

I read about invoking Java methods with emftvm, so I changed my standard ATL Transformation to an emftvm conforming one.

I'm able to invoke the examples like a random UUID.

But now I'm trying to use my own Java Classes and Methods.
I created a other Java Project which contains:
Package example with a Example.java file which has the public class Example and in it the public static boolean doExample() Method

so in my ATL Project i trying to invoke my method with:
helper context String def : compare() : Boolean=
"#native"!"example::Example".refInvokeStaticOperation('doExample');


But i keep getting the error:
org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.ClassNotFoundException: example.Example cannot be found by org.eclipse.m2m.atl.emftvm_4.0.1.v201811191205
at


I don't know how to structure my project to make it work (or find). Where do i have to put my java-file?
I read something about using the dropins-folder, but do i have to compile my java to a .jar first (i tried it but still didn't work)? Is there a way to use the .java-file instead?
Re: Using custom Java Methods with emftvm [message #1804231 is a reply to message #1804178] Wed, 20 March 2019 20:18 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

Your Java code has to be provided as an Eclipse plugin or OSGi bundle in order to appear on your Eclipse's classpath. Basically, that requires you to package your code as a jar file with a specific format of MANIFEST.MF bundled inside.
If you're going this route, you can also use generated EMF models (they take the form of Eclipse plugins), where you can add your custom code in the generated metamodel classes themselves.


Cheers,
Dennis
Previous Topic:Group by name (to created Element)
Next Topic:Importing a model from a model
Goto Forum:
  


Current Time: Sat Nov 11 08:20:00 GMT 2023

Powered by FUDForum. Page generated in 0.01085 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top