Search code examples
rascal

Rascal: Doesn't Find JDK on Windows commandline


I'm trying to run Rascal on Windows from the command line, with the command given on the webpage, but I get this exception:

$ java -Xmx1G -Xss32m -jar rascal-0.18.2.jar
Version: 0.18.2
INFO: detected |lib://rascal| at |jar+file:///D:/workspace/mach/delphi2java/lib/rascal-0.18.2.jar!/|


unexpected error: Unexpected error in Rascal interpreter: Could not find an installed System Java Compiler, please provide a Java Runtime that includes the Java Development Tools (JDK 1.6 or higher).
org.rascalmpl.interpreter.asserts.ImplementationError: Unexpected error in Rascal interpreter: Could not find an installed System Java Compiler, please provide a Java Runtime that includes the Java Development Tools (JDK 1.6 or higher).
        at org.rascalmpl.interpreter.utils.JavaBridge.<init>(JavaBridge.java:92)
        at org.rascalmpl.interpreter.Evaluator.<init>(Evaluator.java:215)
        at org.rascalmpl.interpreter.Evaluator.<init>(Evaluator.java:202)
        at org.rascalmpl.shell.ShellEvaluatorFactory.getDefaultEvaluator(ShellEvaluatorFactory.java:33)
        at org.rascalmpl.shell.REPLRunner$1.constructEvaluator(REPLRunner.java:45)
        at org.rascalmpl.repl.RascalInterpreterREPL.initialize(RascalInterpreterREPL.java:85)
        at org.rascalmpl.repl.BaseREPL.initialize(BaseREPL.java:153)
        at org.rascalmpl.repl.BaseREPL.<init>(BaseREPL.java:108)
        at org.rascalmpl.repl.BaseREPL.<init>(BaseREPL.java:62)
        at org.rascalmpl.shell.REPLRunner.<init>(REPLRunner.java:34)
        at org.rascalmpl.shell.RascalShell.main(RascalShell.java:91)

javac is in my PATH, and I have set JAVA_HOME to the JDK's root directory. What am I missing?


Solution

  • The problem was that I have both a JRE and a JDK on my machine, and the java command was found in the JRE first. I need to invoke Rascal with the java binary from the JDK, e.g. in my case call explicitly

    "c:\Program Files\Java\jdk8\bin\java" -Xmx1G -Xss32m -jar rascal-0.18.2.jar
    

    Having JAVA_HOME set properly and javac in the path does not suffice.