Porting from 1.5 to 2.0.3

Hi MPS Team,

great job you have done with the current MPS 2.0.3 issue. I almost ported all our work from 1.5.

However i have a strange phenomenon. For some reason i get a "error using Class MyClass: Classname not found" when trying
to run a simple java class with main() ..

Any suggestions?
Dan
0
8 comments
As for running your classes, could it be that you need to add the IMainClass (j.m.e.u.structure) interface to your concept?
0
Hi venca,

i just want to run a baselang. Class.

but i get "error using Class MyClass: Classname not found"

Dan
0
Hi, Daniel,

Does the tool window with console appear when you start the class or you just get the balloon with this message?
0
Hi Julia,

only balloon with this message ...

Dan
0

problem.png


This is a picture from the situation - when simply creating a new Project, using baselang, import java.io and create a class, add main, add sout — same problem. same error message ..
0
Daniel,

This loooks like a bug, so I reported it as http://youtrack.jetbrains.net/issue/MPS-15224.
0
Hi Julia,

i just found a somewhat related problem. Maybe those issues are related to the new UnitConcept and the trace.info file.


problem_execution.jpg


As seen in the picture, i have to root mapping rules for Application. The Application Concept is derived from ClassConcept. So there should be a getUnitName() in the behaviour aspect fo Application.

Now strange is, that MPS tries to run the Configuration.xml with javaVm when using right-mouse and run on a Application in solution space. How can i coerce MPS to use the generated java file when instructed to run the concept ... i can remember that i have seen something like unitConcept run="Configuration.xml" .. but i can not reproduce that. Now it seems that no run information is in trace.info

Best,
Dan

Ps. I ll check if trace.info file is missing in the previous situations where i get "error using Class MyClass: Classname not found"
0
Hi Daniel,

It works this way: your instance of Application concept is reduced into a ClassConcept and into a xml concept which in turn is reduced into gtext, then when generating those 2 nodes into text they are both asked what their unit name is. So there is no point to implement Application.getUnitName, it would never be called. On the problem: for each generated root in trace.info file there should be a line which looks like (this is a line from some actual trace info file in MPS):

<unitInfo nodeId="5628057674877715993" fileName="CreateAspect_Action.java" startLine="24" startPosition="0" endLine="81" endPosition="0" unitName="jetbrains.mps.ide.mps.plugin.CreateAspect_Action" />

nodeId is the id of the original node which was generated (in your case an instance of Application concept). fileName is the name of generated file where the unit is. So in your case in trace.info there should be 2 lines like that, one for xml file, one for java file. This case is not currently treated correctly by current java run configuration, it is always expected that there would be one single unit for a node.

Can you regenerate the model whith the node you are trying to run and attach the trace info file somewhere (for example here in this thread) or send me via email to julia.beliaeva [at] jetbrains.com ?

As a quick fix of the problem you can try to write your own run configuration for Application concept. You can copy our run configuration, replace ClassConcept in there with Application and in executor start java command not with the node as we do it, but calculating the name of a class to run by yourself. The other opportunity is to alter the generator so that there will be one mapping rule for an Application node.
0

Please sign in to leave a comment.