Java Runtime / Java Compile-Time

Hi Folks,

this is basically a very simple question, but i did not found an answer in the user guide.

I installed MPS 2019.2 on MacOS, which includes a jbr under Contents/jbr. Obviously the MPS Workbench itself is running on this very jbr.

But which runtime is used, when compiling some baselang generated code? Yes, i can check Preferences > Java Compiler. But it does not state any jdk paths that are used.

What i tried is setting JAVA_HOME in a bash terminal and starting MPS via command line. Seems that the JAVA_HOME Jdk is used to compile and to run baselang generated code within MPS. Is that correct?

Also experimented with the jetbrains "choose runtime" plugin. This plugin seems to switch the jbr MPS is running on. But on my mac, changing the jbr leads to defects in the code completion menu. So i ll stick to the provided standard jbr in the App Contents folder.

Any links to docs or hint appreciated,

Daniel

 

 

5 comments
Comment actions Permalink

As far as I know MPS uses ECJ (Eclipse Compiler for Java) to compile the generated code. MPS 2020.3 contains ecj-4.16.jar in its lib directory.

0
Comment actions Permalink

Hi Sergej,

okay, MPS 2019.2 also contains the ecj-4.10. But then, which environment is used during compilation time, e.g. jar's and classpaths.

Thanks for answering so quickly. : )

Dan

 

 

0
Comment actions Permalink

Basically the runtimes of the languages used by the model, plus their transitive dependencies. Somebody from the MPS team (Artem?) could give more details.

The JDK used for compilation is, I believe, the same JDK that MPS itself runs on.

0
Comment actions Permalink

MPS takes Java runtime from 'java.home' system property, and it's Java that you launch MPS with. I'm unaware of a mechanism to substitute this runtime for MPS IDE once running.

Any mechanism IDEA platform supports to change Java runtime for launch would work for MPS as well - like JAVA_HOME or  "choose runtime" plugin. You need to be careful to use JB SDK, as it's the same runtime MPS/IDEA uses for its own execution and doesn't work well with other runtimes (well, it works, just be ready for some glitches. Quite a twisted interpretation of WORA, if you ask me ;). I used to go with zulu sdk until there's JB SDK for M1, and it worked most of the time, including compilation, except for few menu items I didn't bother to use).

On a side note, MPS does use Eclipse compiler to compile Java code. In 2021.1, we've switched to standard compiler available through javax.tools (with option to use ECJ, if necessary).

0
Comment actions Permalink

Hi Artem,

thanks for comming back on my issue.

Building on your answer and after experimenting  a bit, i conclude that JAVA_HOME is used to execute java baselang classes within mps. On Mac OS, the jbr within the MPS App is used as java runtime for MPS and the compilation process (not the JAVA_HOME specified). This runtime can be switchted with the "Choose Runtime" Plugin.

Thanks for clarifying this issue Artem,

Dan

0

Please sign in to leave a comment.