MPS System Requirements

In the readme.txt of JetBrains, it says that JDK 5.0 and JDK 6.0 are supported. How recent is this?
We have an environment where JDK 1.5 is strictly required and I tried starting MPS, getting a "java.lang.UnsupportedClassVersionError: Bad version number in .class file" exception.
Is it possible to solve this by recompiling MPS with java 1.5? I can imagine that this is not possible because MPS probably requires quite some features from the newer 1.7 and 1.8 JDKs.
5 comments
In the meantime, I tried recompiling MPS for java 1.5, but got compilation errors. Is there an idea about how many new features compared to JDK 5.0 there are now in MPS? If this set of new features is only small, it could be backported by hand maybe. But before I would attempt such an action, it would be very helpful to get an idea about how much "backport actions" we are roughly talking about.
0
Hi, Eugen.

We now build MPS on JDK 6 and language level="java 6", so I'll change readme.txt.
Nevertheless, I've just compiled MPS project with language level="java 5" without any problems. Though I'm not absolutely sure, but it seems to me that we haven't used any of the J6 features (http://www.oracle.com/technetwork/java/javase/features-141434.html). As for run-time problems, I can't say whether there are some - we do the testing on 1.6.

Do you think you really depend on version of java, which MPS is running on? Or you depend on the version of class-files MPS compiles into?
0
Hi Misha,

Thanks for your quick reply!

We do depend on java 1.5 for this specific project, because the client where we are trying to pilot MPS as a tooling requires this in their environment.

Probably I was doing my recompile of MPS somehow wrong. What I did was the following (I was compiling it under Ubuntu 14.04, with a manually downloaded Oracle JDK 1.5.0_04):
* Checkout MPS-master from github (I just used master, maybe I need a certain branch?).
* export JAVA_HOME and JDK_HOME to the directory where I installed java 1.5.0_04
* go to MPS-master/build
* just run ant (without any arguments, because the default target goes to "build")

I also tried ant -Dant.build.javac.target=1.5, just to make sure that the compilation target will be 1.5. All the instances gave me a compiler error (although I see that I get the same error apparantly with the newer java version as well, maybe this is something with this version of MPS-master that I'm trying to compile?):
assemble:
8<
   [javac2] Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
   [javac2] /home/schindlere/Downloads/MPS-master/plugins/diagramEditor/solutions/jetbrains.mps.lang.editor.figures.library/source_gen/jetbrains/mps/lang/editor/figures/library/BoxFigure.java:62: error: adjustPolyLinePoints() has private access in BoxFigure
   [javac2]           getSource().adjustPolyLinePoints();
   [javac2]       ^
8<
   [javac2] 5 errors

<edit>
I tried now to recompile with java 1.7 and get the same compiler error.
So I tried to check out a stable MPS revision instead of master. Downloaded MPS-3.1.4 tag, but it gives exactly the same compiler errors as above (5 errors and then aborts).
Am I compiling it wrong?
</edit>
0
Hi!

First, I suggest you using MPS 3.1 release branch for your experiments: https://github.com/JetBrains/MPS/tree/MPS3.1

Second, the problem you mentioned looks quite strange - it's just a method call from the inner static class to the private method of theatre class.. Can be easily produced because of the difference in JDK 1.5/1.6 compilers.. You can try running all build scripts using JDK6, but specify .class files compatibility parameter to be 1.5 (target="1.5") in ant files. Another option can be to exclude diagramming plugins from the compilation process if you don't need them.
0
Hi Mihail, Alex,

Thank you very much for all your help!
I'll summarize what I learned here for others that may have similar questions:
  • You can compile MPS from sources either with IntelliJ (see https://github.com/JetBrains/MPS#building-mps-from-sources) or by cd'ing to the build directory in the downloaded MPS source tree and calling ./run_build.sh)
  • Compiling MPS under java 1.6 and higher works perfectly, compiling under 1.5 will not work because the IntelliJ base of MPS uses certain java 6 constructs (such as 1.6 ListDeque and Deque classes) that are not available in java 5. This is really to be expected, as for example Eclipse doesn't support java 5 for a while already.
  • "Cross-compiling" from java 1.6 to java 1.5 with –target=1.5 will not work because that only works from older to newer versions. You will get a UnsupportedClassVersionError as well.
  • Unless you want to backport MPS (and part of the IntelliJ infra!) to java 1.5 and maintain such a backported version, there are no more options to run MPS with a system java.
  • As recommended by JetBrains: the best way to go is to use a local version of jre as part of the MPS installation, as is done in the Windows version of MPS (where jre is on the top-level of the MPS install directory).
  • If you need to build from command line, similar things apply for ant dependency (currently ant 1.8.2 is used by MPS). Use the prepackaged ant, otherwise you may miss functionality that is required by the MPS build infra.

Thanks again for all the useful feedback and thinking along. I hope that this small summary will at least partially help others that need to investigate something like this.
0

Please sign in to leave a comment.