Running Mint Programs in DrJava

I have now managed to hack DrJava and Mint together. I still have to improve the source, because right now a few things are hard-coded, but it is a working proof-of-concept.

Welcome to DrJava.  Working directory is C:\Program Files\JavaMint\langtools\mintTest
> java edu.rice.cs.mint.runtime.Mint Power_For
131072.0
> 

This is the output for the Mint program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import edu.rice.cs.mint.runtime.Code;
public class Power_For {
  public static void main(String[] args) {
    final double x = 2;
    int n = 17;
   
    Code<Double> c = <| 1.0 |>;
    for(int i=0; i<n; ++i) {
      c = <| `c * x |>;
    }
   
    System.out.println(c.run());
  }
}

It is a bit inconvenient because you have to invoke the Mint launcher, edu.rice.cs.mint.runtime.Mint, but that can be changed too.

The last problem that I had was the class path when the compiler is invoked at runtime. It took some time to understand that, because instead of saying something like “Class not found”, the error message was “Variable not found”. But because the compiler didn’t find a class definition for a certain symbol, it assumed the symbol had to be a variable.

More information later.

Share

About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in DrJava, Mint. Bookmark the permalink.

Leave a Reply