Pergunta

I am writing a an interface for a web application that requires a user to write a small blob of Java in a JavaScript text area. I would like to know if there exists an editor written in JavaScript that can do Java syntax checking? Google searches produce JavaScript editors but no Java Editors written in JavaScript. (Granted, I only looked 5 pages deep)

Foi útil?

Solução

Do you need syntax checking (i.e. checking if the code is valid and compilable), or just syntax highlighting (making it pretty colors)? If the latter, then search for a syntax highlighting editor, not "Java editor."

If you need actual syntax checking you'll probably need to either do that on the server side (with an Ajax call) or write a Java applet to do it in the page. Writing a Java parser in JavaScript is certainly possible, but probably beyond the practical scope of what you're trying to do.

Either way, this Wikipedia article would be a great place to start: Comparison of JavaScript-based source code editors.

Outras dicas

You might get some ideas from this Wikipedia page.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top