Search code examples
javascriptcodemirror

How to set a Java mode in CodeMirror editor?


I have read CodeMirror User Manual, but I couldn't find how to set mode for JAVA, could you help me?

CodeMirror.fromTextArea(document.getElementById("code1"), {
  lineNumbers: true,
  mode: "text/x-csrc",
  matchBrackets: true
});

Solution

  • "text/x-java" is the MIME type used to get the Java mode.